Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ from huggingface_hub import HfApi, create_repo, upload_file
|
|
7 |
from datasets import Dataset
|
8 |
|
9 |
# File paths
|
10 |
-
INPUT_CSV = "
|
11 |
OUTPUT_CSV = "results.csv" # Local backup file path
|
12 |
TEMP_JSON = "temp_results.jsonl" # Temporary file for storing results as JSONL
|
13 |
|
@@ -22,7 +22,7 @@ def load_data():
|
|
22 |
return pd.read_csv(INPUT_CSV)
|
23 |
else:
|
24 |
# Create empty dataframe with required columns if file doesn't exist
|
25 |
-
return pd.DataFrame(columns=["
|
26 |
|
27 |
def initialize_hf_dataset():
|
28 |
"""Initialize a HuggingFace dataset repository if it doesn't exist"""
|
@@ -222,11 +222,11 @@ with gr.Blocks(title="Summary Chooser") as interface:
|
|
222 |
result_box = gr.Textbox(label="Result")
|
223 |
|
224 |
# Initialize with the first item
|
225 |
-
|
226 |
text_id_box.value = id
|
227 |
-
text_box.value =
|
228 |
-
summary_a.value =
|
229 |
-
summary_b.value =
|
230 |
progress_label.value = prog
|
231 |
|
232 |
# Set up event handlers
|
|
|
7 |
from datasets import Dataset
|
8 |
|
9 |
# File paths
|
10 |
+
INPUT_CSV = "summaries.csv" # Change this to your input CSV path
|
11 |
OUTPUT_CSV = "results.csv" # Local backup file path
|
12 |
TEMP_JSON = "temp_results.jsonl" # Temporary file for storing results as JSONL
|
13 |
|
|
|
22 |
return pd.read_csv(INPUT_CSV)
|
23 |
else:
|
24 |
# Create empty dataframe with required columns if file doesn't exist
|
25 |
+
return pd.DataFrame(columns=["text_id", "text", "summary_a", "summary_b"])
|
26 |
|
27 |
def initialize_hf_dataset():
|
28 |
"""Initialize a HuggingFace dataset repository if it doesn't exist"""
|
|
|
222 |
result_box = gr.Textbox(label="Result")
|
223 |
|
224 |
# Initialize with the first item
|
225 |
+
text_id, text, summary_a, summary_b, prog = app.get_current_item()
|
226 |
text_id_box.value = id
|
227 |
+
text_box.value = text
|
228 |
+
summary_a.value = summary_a
|
229 |
+
summary_b.value = summary_b
|
230 |
progress_label.value = prog
|
231 |
|
232 |
# Set up event handlers
|