|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": 1, |
| 5 | + "execution_count": null, |
6 | 6 | "metadata": { |
7 | | - "colab": { |
8 | | - "base_uri": "https://localhost:8080/" |
9 | | - }, |
10 | | - "id": "TYL7OLjWanv_", |
11 | | - "outputId": "8e8b2e7e-37e1-4ece-a219-b34cdb6bcc79" |
| 7 | + "id": "TYL7OLjWanv_" |
12 | 8 | }, |
13 | | - "outputs": [ |
14 | | - { |
15 | | - "name": "stdout", |
16 | | - "output_type": "stream", |
17 | | - "text": [ |
18 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m63.1/63.1 kB\u001b[0m \u001b[31m2.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
19 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m363.4/363.4 MB\u001b[0m \u001b[31m4.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
20 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m13.8/13.8 MB\u001b[0m \u001b[31m27.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
21 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m24.6/24.6 MB\u001b[0m \u001b[31m32.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
22 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m883.7/883.7 kB\u001b[0m \u001b[31m20.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
23 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m664.8/664.8 MB\u001b[0m \u001b[31m2.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
24 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m211.5/211.5 MB\u001b[0m \u001b[31m5.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
25 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m56.3/56.3 MB\u001b[0m \u001b[31m12.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
26 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m127.9/127.9 MB\u001b[0m \u001b[31m7.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
27 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m207.5/207.5 MB\u001b[0m \u001b[31m6.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
28 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m21.1/21.1 MB\u001b[0m \u001b[31m81.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
29 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m62.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
30 | | - "\u001b[?25h" |
31 | | - ] |
32 | | - } |
33 | | - ], |
| 9 | + "outputs": [], |
34 | 10 | "source": [ |
35 | 11 | "!pip install -q torch torch-geometric pandas duckdb pyarrow networkx gradio -q" |
36 | 12 | ] |
37 | 13 | }, |
38 | 14 | { |
39 | 15 | "cell_type": "code", |
40 | | - "execution_count": 4, |
| 16 | + "execution_count": null, |
41 | 17 | "metadata": { |
42 | | - "colab": { |
43 | | - "base_uri": "https://localhost:8080/", |
44 | | - "height": 669 |
45 | | - }, |
46 | | - "id": "cAanZXMGaSGF", |
47 | | - "outputId": "7e27d6cc-6554-47ce-e675-4e40a365c9e7" |
| 18 | + "id": "cAanZXMGaSGF" |
48 | 19 | }, |
49 | | - "outputs": [ |
50 | | - { |
51 | | - "name": "stdout", |
52 | | - "output_type": "stream", |
53 | | - "text": [ |
54 | | - "Mounted at /content/drive\n", |
55 | | - "It looks like you are running Gradio on a hosted a Jupyter notebook. For the Gradio app to work, sharing must be enabled. Automatically setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n", |
56 | | - "\n", |
57 | | - "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n", |
58 | | - "* Running on public URL: https://b69dd71c31c2a5f22c.gradio.live\n", |
59 | | - "\n", |
60 | | - "This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n" |
61 | | - ] |
62 | | - }, |
63 | | - { |
64 | | - "data": { |
65 | | - "text/html": [ |
66 | | - "<div><iframe src=\"https://b69dd71c31c2a5f22c.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>" |
67 | | - ], |
68 | | - "text/plain": [ |
69 | | - "<IPython.core.display.HTML object>" |
70 | | - ] |
71 | | - }, |
72 | | - "metadata": {}, |
73 | | - "output_type": "display_data" |
74 | | - } |
75 | | - ], |
| 20 | + "outputs": [], |
76 | 21 | "source": [ |
77 | 22 | "import gradio as gr\n", |
78 | 23 | "import pandas as pd\n", |
|
93 | 38 | "# Add the project root to the Python path\n", |
94 | 39 | "project_root = \"/content/drive/My Drive/WebKnoGraph\"\n", |
95 | 40 | "if project_root not in sys.path:\n", |
96 | | - " sys.sys.path.insert(0, project_root)\n", |
| 41 | + " sys.path.insert(0, project_root) # Corrected: removed extra 'sys.'\n", |
97 | 42 | "\n", |
98 | 43 | "# --- Import Real Classes from WebKnoGraph Project ---\n", |
99 | 44 | "try:\n", |
|
156 | 101 | " )\n", |
157 | 102 | " self.node_mapping_path = os.path.join(base_path, \"model_metadata.json\")\n", |
158 | 103 | " self.edge_index_path = os.path.join(base_path, \"edge_index.pt\")\n", |
159 | | - " self.link_graph_edges_path = os.path.join(\n", |
| 104 | + " self.edge_csv_path = os.path.join(\n", |
160 | 105 | " base_path, \"link_graph_edges.csv\"\n", |
161 | | - " ) # Dummy path\n", |
| 106 | + " ) # Corrected dummy path\n", |
162 | 107 | "\n", |
163 | 108 | " # Dummy ILogger for fallback scenario\n", |
164 | 109 | " class ILogger:\n", |
|
529 | 474 | " results = []\n", |
530 | 475 | " successful_recommendations_count = 0\n", |
531 | 476 | "\n", |
532 | | - " # --- Generate Original Graph Edges CSV by loading from config.link_graph_edges_path ---\n", |
| 477 | + " # --- Generate Original Graph Edges CSV by loading from config.edge_csv_path ---\n", |
533 | 478 | " try:\n", |
534 | 479 | " df_original_edges = pd.read_csv(\n", |
535 | 480 | " config.edge_csv_path\n", |
|
0 commit comments