cstr commited on
Commit
b945468
·
verified ·
1 Parent(s): 9fc6811

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -11,7 +11,9 @@ import traceback
11
  # it will find the file in the cache and NOT re-download 19.3 GB.
12
  print("Downloading database (if not already cached)...")
13
  REPO_ID = "ysenarath/conceptnet-sqlite"
14
- DB_FILENAME = "data/conceptnet.db"
 
 
15
  DB_PATH = hf_hub_download(
16
  repo_id=REPO_ID,
17
  filename=DB_FILENAME,
@@ -70,8 +72,11 @@ def get_schema_info():
70
  pk = bool(col[5])
71
  schema_md += f"| `{name}` | `{dtype}` | {notnull} | {pk} |\n"
72
  schema_md += "\n"
73
-
74
- return schema_md
 
 
 
75
  except Exception as e:
76
  print(f"Error in get_schema_info: {e}")
77
  traceback.print_exc()
@@ -135,7 +140,7 @@ def run_query(start_node, relation, end_node, limit):
135
 
136
  with gr.Blocks(title="ConceptNet SQLite Explorer") as demo:
137
  gr.Markdown("# ConceptNet SQLite Explorer")
138
- gr.Markdown(f"Successfully loaded database from `{DB_PATH}`")
139
 
140
  with gr.Tabs():
141
  with gr.TabItem("Schema Explorer"):
 
11
  # it will find the file in the cache and NOT re-download 19.3 GB.
12
  print("Downloading database (if not already cached)...")
13
  REPO_ID = "ysenarath/conceptnet-sqlite"
14
+
15
+ DB_FILENAME = "data/conceptnet-v5.7.0.db"
16
+
17
  DB_PATH = hf_hub_download(
18
  repo_id=REPO_ID,
19
  filename=DB_FILENAME,
 
72
  pk = bool(col[5])
73
  schema_md += f"| `{name}` | `{dtype}` | {notnull} | {pk} |\n"
74
  schema_md += "\n"
75
+
76
+ # --- FIX: Moved return statement outside the loop ---
77
+ return schema_md
78
+ # --- End of Fix ---
79
+
80
  except Exception as e:
81
  print(f"Error in get_schema_info: {e}")
82
  traceback.print_exc()
 
140
 
141
  with gr.Blocks(title="ConceptNet SQLite Explorer") as demo:
142
  gr.Markdown("# ConceptNet SQLite Explorer")
143
+ gr.Markdown(f"This app is designed to load the database from `{REPO_ID}`.")
144
 
145
  with gr.Tabs():
146
  with gr.TabItem("Schema Explorer"):