SushantGautam commited on
Commit
1d9d174
·
1 Parent(s): c40b1ac

Refactor Gradio interface to improve submission filtering and search functionality; add search button and update layout.

Browse files
Files changed (1) hide show
  1. gradio_interface.py +30 -29
gradio_interface.py CHANGED
@@ -148,36 +148,37 @@ with gr.Blocks(title="🌟ImageCLEFmed-MEDVQA-GI 2025 Submissions 🌟") as demo
148
  """)
149
  with gr.Tab("View Submissions"):
150
  gr.Markdown("### Submissions Table")
151
- gr.Interface(
152
- fn=display_submissions,
153
- inputs=[task_type_dropdown, search_box],
154
- outputs=output_table,
155
- title="ImageCLEFmed-MEDVQA-GI-2025 Submissions",
156
- description="Filter and search submissions by task type and user:"
 
 
 
 
 
 
 
 
 
 
 
 
157
  )
158
- gr.Markdown(
159
- f'''
160
- 🔄 Last refreshed: {last_submission_update_time.strftime('%Y-%m-%d %H:%M:%S')} UTC | 📊 Total Submissions: {len(submissions)}
161
-
162
- 💬 For any questions or issues, [contact the organizers](https://github.com/simula/ImageCLEFmed-MEDVQA-GI-2025#-organizers) or check the documentation in the [GitHub repo](https://github.com/simula/ImageCLEFmed-MEDVQA-GI-2025). Good luck and thank you for contributing to medical AI research! 💪🤖🌍
163
- ''')
164
-
165
- with gr.Tab("Upload Submission", visible=False):
166
- file_input = gr.File(label="Upload JSON", file_types=["json"])
167
- upload_output = gr.Textbox(label="Result") # Add this line
168
- file_input.upload(add_submission, file_input,
169
- upload_output)
170
-
171
- with gr.Tab("Refresh API", visible=False):
172
- gr.Interface(
173
- api_name="RefreshAPI",
174
- fn=refresh_page,
175
- inputs=[],
176
- outputs="text",
177
- title="Refresh API",
178
- description="Hidden interface to refresh the API."
179
  )
180
- demo.load(lambda: gr.update(value=[[s["user"], s["task"], s["submitted_time"]]
181
- for s in filter_submissions("all", "")]), inputs=[], outputs=output_table)
 
 
182
 
183
  demo.launch()
 
148
  """)
149
  with gr.Tab("View Submissions"):
150
  gr.Markdown("### Submissions Table")
151
+
152
+ with gr.Row():
153
+ task_type_dropdown = gr.Dropdown(
154
+ choices=["all", "task1", "task2"],
155
+ value="all",
156
+ label="Task Type",
157
+ )
158
+ search_box = gr.Textbox(
159
+ label="Search by Username",
160
+ placeholder="Enter a username to search"
161
+ )
162
+ search_button = gr.Button("Search")
163
+
164
+ output_table = gr.Dataframe(
165
+ headers=["User", "Task", "Submitted Time"],
166
+ interactive=False,
167
+ value=[],
168
+ scale=5,
169
  )
170
+
171
+ def update_table(task, query):
172
+ return [[s["user"], s["task"], s["submitted_time"]] for s in filter_submissions(task, query)]
173
+
174
+ search_button.click(
175
+ fn=update_table,
176
+ inputs=[task_type_dropdown, search_box],
177
+ outputs=output_table
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  )
179
+
180
+ demo.load(fn=lambda: [[s["user"], s["task"], s["submitted_time"]] for s in filter_submissions("all", "")],
181
+ inputs=[],
182
+ outputs=output_table)
183
 
184
  demo.launch()