Spaces:
Sleeping
Sleeping
elibrowne
commited on
Commit
•
a425fa9
1
Parent(s):
3603153
Loading data?
Browse files
app.py
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
4 |
-
#
|
|
|
5 |
import json
|
6 |
from datetime import datetime
|
7 |
from pathlib import Path
|
8 |
from uuid import uuid4
|
9 |
from huggingface_hub import CommitScheduler
|
10 |
|
11 |
-
# PERSISTENT DATA STORAGE: these are used to upload user responses to a dataset
|
12 |
-
|
13 |
JSON_DATASET_DIR = Path("json_dataset")
|
14 |
JSON_DATASET_DIR.mkdir(parents=True, exist_ok=True)
|
15 |
|
@@ -29,6 +28,13 @@ def save_json(score1, score2):
|
|
29 |
json.dump({"relevance": score1, "novelty": score2, "datetime": datetime.now().isoformat()}, f)
|
30 |
f.write("\n")
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
# VARIABLES: will eventually be loaded with JSON from a dataset
|
33 |
|
34 |
question_text = """
|
@@ -50,6 +56,9 @@ with gr.Blocks() as user_eval:
|
|
50 |
# Passage text
|
51 |
with gr.Column(scale = 2) as passages:
|
52 |
passage_display = gr.Markdown("""
|
|
|
|
|
|
|
53 |
### Relevant Passages
|
54 |
- Dataset 1
|
55 |
- Dataset 2
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
4 |
+
# PERSISTENT DATA STORAGE: these are used to upload user responses to a dataset
|
5 |
+
|
6 |
import json
|
7 |
from datetime import datetime
|
8 |
from pathlib import Path
|
9 |
from uuid import uuid4
|
10 |
from huggingface_hub import CommitScheduler
|
11 |
|
|
|
|
|
12 |
JSON_DATASET_DIR = Path("json_dataset")
|
13 |
JSON_DATASET_DIR.mkdir(parents=True, exist_ok=True)
|
14 |
|
|
|
28 |
json.dump({"relevance": score1, "novelty": score2, "datetime": datetime.now().isoformat()}, f)
|
29 |
f.write("\n")
|
30 |
|
31 |
+
# READING EXISTING DATA: this is used to read questionss
|
32 |
+
|
33 |
+
from datasets import load_dataset
|
34 |
+
qa_data = load_dataset("ebrowne/test-data", data_files = "test.json")
|
35 |
+
loaded_text = qa_data["train"]["example_string"][0]
|
36 |
+
|
37 |
+
|
38 |
# VARIABLES: will eventually be loaded with JSON from a dataset
|
39 |
|
40 |
question_text = """
|
|
|
56 |
# Passage text
|
57 |
with gr.Column(scale = 2) as passages:
|
58 |
passage_display = gr.Markdown("""
|
59 |
+
### Question
|
60 |
+
""" + loaded_text +
|
61 |
+
"""
|
62 |
### Relevant Passages
|
63 |
- Dataset 1
|
64 |
- Dataset 2
|