abby101 commited on
Commit
239e68c
1 Parent(s): 8e3f751

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -10,32 +10,3 @@ data/raw/astro_physpace/astro-ph_6000_last_updated_date_desc_20240715_134752.jso
10
  data/raw/evo_bio/q-bio.PE_10000_last_updated_date_desc_20240723_163228.jsonl filter=lfs diff=lfs merge=lfs -text
11
  data/raw/fluid_dyn/physics.flu-dyn_10000_last_updated_date_desc_20240723_155932.jsonl filter=lfs diff=lfs merge=lfs -text
12
  data/raw/phy_strat/stratified_arxiv_data_combined_astro_physpace.jsonl filter=lfs diff=lfs merge=lfs -text
13
- data/results/new_random_json_QdeCg2hM_20240801_034716/logs/log.txt filter=lfs diff=lfs merge=lfs -text
14
- data/results/new_random_json_QdeCg2hM_20240801_034716/predicted_responses.txt filter=lfs diff=lfs merge=lfs -text
15
- data/results/new_random_json_QdeCg2hM_20240801_034716/predictions.json filter=lfs diff=lfs merge=lfs -text
16
- data/results/new_random_json_QdeCg2hM_20240801_034716/prompts.txt filter=lfs diff=lfs merge=lfs -text
17
- data/results/new_random_json_bsnlEItA_20240725_031746/logs/log.txt filter=lfs diff=lfs merge=lfs -text
18
- data/results/new_random_json_bsnlEItA_20240725_031746/prompts.txt filter=lfs diff=lfs merge=lfs -text
19
- data/results/new_random_json_combined_preds_across_runs_astrophyspace/new_random_json_NPhqPpXy_20240716_040707/logs/log.txt filter=lfs diff=lfs merge=lfs -text
20
- data/results/new_random_json_combined_preds_across_runs_astrophyspace/new_random_json_lWUgWudS_20240717_164223/logs/log.txt filter=lfs diff=lfs merge=lfs -text
21
- data/results/new_random_json_combined_preds_across_runs_astrophyspace/new_random_json_lWUgWudS_20240717_164223/prompts.txt filter=lfs diff=lfs merge=lfs -text
22
- data/results/new_random_json_combined_preds_across_runs_astrophyspace/predictions.json filter=lfs diff=lfs merge=lfs -text
23
- data/results/new_random_json_g1PPhwYp_20240725_031815/logs/log.txt filter=lfs diff=lfs merge=lfs -text
24
- data/results/new_random_json_g1PPhwYp_20240725_031815/prompts.txt filter=lfs diff=lfs merge=lfs -text
25
- data/results/new_random_readable_Y7zNEy1v_20240725_031826/duped_predictions.json filter=lfs diff=lfs merge=lfs -text
26
- data/results/new_random_readable_Y7zNEy1v_20240725_031826/logs/log.txt filter=lfs diff=lfs merge=lfs -text
27
- data/results/new_random_readable_Y7zNEy1v_20240725_031826/predicted_responses.txt filter=lfs diff=lfs merge=lfs -text
28
- data/results/new_random_readable_Y7zNEy1v_20240725_031826/prompts.txt filter=lfs diff=lfs merge=lfs -text
29
- data/results/new_random_readable_b1AKFDbd_20240725_031800/duped_predictions.json filter=lfs diff=lfs merge=lfs -text
30
- data/results/new_random_readable_b1AKFDbd_20240725_031800/logs/log.txt filter=lfs diff=lfs merge=lfs -text
31
- data/results/new_random_readable_b1AKFDbd_20240725_031800/predicted_responses.txt filter=lfs diff=lfs merge=lfs -text
32
- data/results/new_random_readable_b1AKFDbd_20240725_031800/prompts.txt filter=lfs diff=lfs merge=lfs -text
33
- data/results/new_random_readable_combined_preds_across_runs_astrophyspace/new_random_readable_RLKNTmuL_20240716_141932/prompts.txt filter=lfs diff=lfs merge=lfs -text
34
- data/results/new_random_readable_combined_preds_across_runs_astrophyspace/new_random_readable_dpjyPtQ1_20240717_161329/duped_predictions.json filter=lfs diff=lfs merge=lfs -text
35
- data/results/new_random_readable_combined_preds_across_runs_astrophyspace/new_random_readable_dpjyPtQ1_20240717_161329/logs/log.txt filter=lfs diff=lfs merge=lfs -text
36
- data/results/new_random_readable_combined_preds_across_runs_astrophyspace/new_random_readable_dpjyPtQ1_20240717_161329/predicted_responses.txt filter=lfs diff=lfs merge=lfs -text
37
- data/results/new_random_readable_combined_preds_across_runs_astrophyspace/new_random_readable_dpjyPtQ1_20240717_161329/prompts.txt filter=lfs diff=lfs merge=lfs -text
38
- data/results/new_random_readable_combined_preds_across_runs_astrophyspace/predictions.json filter=lfs diff=lfs merge=lfs -text
39
- data/results/new_random_readable_ffDyTFzv_20240801_034725/logs/log.txt filter=lfs diff=lfs merge=lfs -text
40
- data/results/new_random_readable_ffDyTFzv_20240801_034725/predictions.json filter=lfs diff=lfs merge=lfs -text
41
- data/results/new_random_readable_ffDyTFzv_20240801_034725/prompts.txt filter=lfs diff=lfs merge=lfs -text
 
10
  data/raw/evo_bio/q-bio.PE_10000_last_updated_date_desc_20240723_163228.jsonl filter=lfs diff=lfs merge=lfs -text
11
  data/raw/fluid_dyn/physics.flu-dyn_10000_last_updated_date_desc_20240723_155932.jsonl filter=lfs diff=lfs merge=lfs -text
12
  data/raw/phy_strat/stratified_arxiv_data_combined_astro_physpace.jsonl filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import os
3
+
4
+ sys.stdout.reconfigure(line_buffering=True)
5
+ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
6
+
7
+ from scripts.run_db_interface import launch
8
+
9
+ if __name__ == "__main__":
10
+ launch()
assets/graph-prev.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:263c60b4a26b6d32e96ccdacd92a4edf9787581f5dee9b9eb182d8b1502044c0
3
- size 7540171
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba3ff1c5a2ec16b31177a9662f6ac1cbb8a13a52d2eec1e1cdb162145d627028
3
+ size 132
assets/graph.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:28392771ef7d72e204adf2273cadc2728a6f89f9e54ab71c162bf387d596faa4
3
- size 21734557
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:04b1b37adf5de681bf53060f35c0be2c6112b4b2b10deb08b991c166596eb3e6
3
+ size 133
assets/kg4s-demo.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f3faa731c6f5cb5bc694a56c80690acc0486356fd51bbe5163b4feff50d316f7
3
- size 90726535
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6dfd2fbff562ce37b5b3ab9ed65387a801c079733425ca4ffec102299904f83a
3
+ size 133
assets/kg4s-graph.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ef8d4980ac07ef08ea940fbc6ddb5c0fed460e385074be6eae1f069a9c7c4844
3
- size 27332577
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e542acbdac64b580143bfa2e726f7d7f22c86c33e86af4004a88a29fd954a042
3
+ size 133
assets/kg4s-preview.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:48078c4726cbea8dae008016bcafff51c40c16cd4d7914f8e01a16bac4102901
3
- size 8467193
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:323e09894a658a0b450db58454e451e2736b8ee1f090986ae1a51904b8a448d4
3
+ size 132
run_tool.sh CHANGED
@@ -16,4 +16,4 @@ module load gcc/10.3.0 cuda/12.1.1 python/3.11.7
16
  cd /mnt/home/adas1/projects/knowledge-graph/kg-for-science
17
  conda init
18
  conda activate kg4s
19
- python scripts/run_db_interface.py
 
16
  cd /mnt/home/adas1/projects/knowledge-graph/kg-for-science
17
  conda init
18
  conda activate kg4s
19
+ python -u app.py
scripts/run_db_interface.py CHANGED
@@ -7,13 +7,14 @@ import plotly.graph_objects as go
7
  import re
8
  import sys
9
  import sqlite3
 
10
 
11
  from plotly.subplots import make_subplots
12
  from tabulate import tabulate
13
 
14
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
15
- from create_db import ArxivDatabase
16
  from config import DEFAULT_TABLES_DIR, DEFAULT_INTERFACE_MODEL_ID, canned_queries
 
17
  from src.utils.utils import set_env_vars
18
 
19
  db = None
@@ -216,71 +217,85 @@ css = """
216
  }
217
  """
218
 
219
- with gr.Blocks(css=css) as demo:
220
- gr.Markdown("# ArXiv Database Query Interface")
221
 
222
- with gr.Row():
223
- db_dropdown = gr.Dropdown(
224
- choices=get_available_databases(), label="Select Database"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  )
226
- load_db_btn = gr.Button("Load Database", size="sm")
227
- status = gr.Textbox(label="Status")
228
-
229
- with gr.Row():
230
- graph_output = gr.Plot(label="Concept Co-occurrence Graph")
231
-
232
- with gr.Row():
233
- wrap_checkbox = gr.Checkbox(label="Wrap long text", value=False)
234
- canned_query_dropdown = gr.Dropdown(
235
- choices=[q[0] for q in canned_queries], label="Select Query", scale=3
236
  )
237
- limit_input = gr.Number(label="Limit", value=10000, step=1, minimum=1, scale=1)
238
- selected_query = gr.Textbox(
239
- label="Selected Query",
240
- interactive=False,
241
- scale=2,
242
- show_label=True,
243
- show_copy_button=True,
244
- elem_id="selected-query",
 
245
  )
246
- canned_query_submit = gr.Button("Submit Query", size="sm", scale=1)
247
-
248
- with gr.Row():
249
- sql_input = gr.Textbox(label="Custom SQL Query", lines=3, scale=4)
250
- sql_submit = gr.Button("Submit Custom SQL", size="sm", scale=1)
251
-
252
- output = gr.DataFrame(label="Results", wrap=True)
253
-
254
- def update_selected_query(query_description):
255
- for desc, sql in canned_queries:
256
- if desc == query_description:
257
- return sql
258
- return ""
259
-
260
- def submit_canned_query(query_description, limit, wrap):
261
- for desc, sql in canned_queries:
262
- if desc == query_description:
263
- return query_db(sql, True, limit, wrap)
264
- return pd.DataFrame({"Error": ["Selected query not found."]})
265
 
266
- load_db_btn.click(
267
- load_database_with_graphs, inputs=[db_dropdown], outputs=[status, graph_output]
268
- )
269
- canned_query_dropdown.change(
270
- update_selected_query, inputs=[canned_query_dropdown], outputs=[selected_query]
271
- )
272
- canned_query_submit.click(
273
- submit_canned_query,
274
- inputs=[canned_query_dropdown, limit_input, wrap_checkbox],
275
- outputs=output,
276
- )
277
- sql_submit.click(
278
- query_db,
279
- inputs=[sql_input, gr.Checkbox(value=True), limit_input, wrap_checkbox],
280
- outputs=output,
281
  )
282
 
283
- if __name__ == "__main__":
284
- demo.launch(share=True)
285
 
286
- demo.launch()
 
 
7
  import re
8
  import sys
9
  import sqlite3
10
+ import time
11
 
12
  from plotly.subplots import make_subplots
13
  from tabulate import tabulate
14
 
15
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
16
  from config import DEFAULT_TABLES_DIR, DEFAULT_INTERFACE_MODEL_ID, canned_queries
17
+ from scripts.create_db import ArxivDatabase
18
  from src.utils.utils import set_env_vars
19
 
20
  db = None
 
217
  }
218
  """
219
 
 
 
220
 
221
+ def launch():
222
+ with gr.Blocks(css=css) as demo:
223
+ gr.Markdown("# ArXiv Database Query Interface")
224
+
225
+ with gr.Row():
226
+ db_dropdown = gr.Dropdown(
227
+ choices=get_available_databases(), label="Select Database"
228
+ )
229
+ load_db_btn = gr.Button("Load Database", size="sm")
230
+ status = gr.Textbox(label="Status")
231
+
232
+ with gr.Row():
233
+ graph_output = gr.Plot(label="Concept Co-occurrence Graph")
234
+
235
+ with gr.Row():
236
+ wrap_checkbox = gr.Checkbox(label="Wrap long text", value=False)
237
+ canned_query_dropdown = gr.Dropdown(
238
+ choices=[q[0] for q in canned_queries], label="Select Query", scale=3
239
+ )
240
+ limit_input = gr.Number(
241
+ label="Limit", value=10000, step=1, minimum=1, scale=1
242
+ )
243
+ selected_query = gr.Textbox(
244
+ label="Selected Query",
245
+ interactive=False,
246
+ scale=2,
247
+ show_label=True,
248
+ show_copy_button=True,
249
+ elem_id="selected-query",
250
+ )
251
+ canned_query_submit = gr.Button("Submit Query", size="sm", scale=1)
252
+
253
+ with gr.Row():
254
+ sql_input = gr.Textbox(label="Custom SQL Query", lines=3, scale=4)
255
+ sql_submit = gr.Button("Submit Custom SQL", size="sm", scale=1)
256
+
257
+ output = gr.DataFrame(label="Results", wrap=True)
258
+
259
+ def update_selected_query(query_description):
260
+ for desc, sql in canned_queries:
261
+ if desc == query_description:
262
+ return sql
263
+ return ""
264
+
265
+ def submit_canned_query(query_description, limit, wrap):
266
+ for desc, sql in canned_queries:
267
+ if desc == query_description:
268
+ return query_db(sql, True, limit, wrap)
269
+ return pd.DataFrame({"Error": ["Selected query not found."]})
270
+
271
+ load_db_btn.click(
272
+ load_database_with_graphs,
273
+ inputs=[db_dropdown],
274
+ outputs=[status, graph_output],
275
  )
276
+ canned_query_dropdown.change(
277
+ update_selected_query,
278
+ inputs=[canned_query_dropdown],
279
+ outputs=[selected_query],
 
 
 
 
 
 
280
  )
281
+ canned_query_submit.click(
282
+ submit_canned_query,
283
+ inputs=[canned_query_dropdown, limit_input, wrap_checkbox],
284
+ outputs=output,
285
+ )
286
+ sql_submit.click(
287
+ query_db,
288
+ inputs=[sql_input, gr.Checkbox(value=True), limit_input, wrap_checkbox],
289
+ outputs=output,
290
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
 
292
+ print("Launching Gradio app...", flush=True)
293
+ demo.launch(share=True)
294
+ print(
295
+ "Gradio app launched. If you don't see a URL above, there might be network restrictions.",
296
+ flush=True,
 
 
 
 
 
 
 
 
 
 
297
  )
298
 
 
 
299
 
300
+ if __name__ == "__main__":
301
+ launch()