Commit
·
cb3460f
1
Parent(s):
9c7170b
test gradio
Browse files- gradio_interface.py +12 -19
gradio_interface.py
CHANGED
|
@@ -104,15 +104,11 @@ def display_submissions(task_type="all", search_query=""):
|
|
| 104 |
|
| 105 |
|
| 106 |
def add_submission(file):
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
submissions.append(submission)
|
| 113 |
-
return "Submissions added successfully!"
|
| 114 |
-
except Exception as e:
|
| 115 |
-
return f"Error: {str(e)}"
|
| 116 |
|
| 117 |
|
| 118 |
def refresh_page():
|
|
@@ -133,19 +129,16 @@ with gr.Blocks(title="ImageCLEFmed-MEDVQA-GI-2025 Submissions") as demo:
|
|
| 133 |
gr.Interface(
|
| 134 |
fn=display_submissions,
|
| 135 |
inputs=[task_type_dropdown, search_box],
|
| 136 |
-
outputs=output_table,
|
| 137 |
title="ImageCLEFmed-MEDVQA-GI-2025 Submissions",
|
| 138 |
description="Filter and search submissions by task type and user."
|
| 139 |
)
|
| 140 |
-
with gr.Tab("Upload Submission", visible=
|
| 141 |
-
gr.
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
title="Upload Submissions",
|
| 147 |
-
description="Upload a JSON file to add new submissions."
|
| 148 |
-
)
|
| 149 |
with gr.Tab("Refresh API", visible=False):
|
| 150 |
gr.Interface(
|
| 151 |
api_name="RefreshAPI",
|
|
|
|
| 104 |
|
| 105 |
|
| 106 |
def add_submission(file):
|
| 107 |
+
with open(file, 'r', encoding='utf-8') as f:
|
| 108 |
+
data = json.load(f)
|
| 109 |
+
print("Adding submission...", data)
|
| 110 |
+
print(data)
|
| 111 |
+
return "Submissions added successfully!"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
|
| 114 |
def refresh_page():
|
|
|
|
| 129 |
gr.Interface(
|
| 130 |
fn=display_submissions,
|
| 131 |
inputs=[task_type_dropdown, search_box],
|
| 132 |
+
outputs=output_table, # Update this line
|
| 133 |
title="ImageCLEFmed-MEDVQA-GI-2025 Submissions",
|
| 134 |
description="Filter and search submissions by task type and user."
|
| 135 |
)
|
| 136 |
+
with gr.Tab("Upload Submission", visible=True):
|
| 137 |
+
file_input = gr.File(label="Upload JSON", file_types=["json"])
|
| 138 |
+
upload_output = gr.Textbox(label="Result") # Add this line
|
| 139 |
+
file_input.upload(add_submission, file_input,
|
| 140 |
+
upload_output)
|
| 141 |
+
|
|
|
|
|
|
|
|
|
|
| 142 |
with gr.Tab("Refresh API", visible=False):
|
| 143 |
gr.Interface(
|
| 144 |
api_name="RefreshAPI",
|