SushantGautam commited on
Commit
b445d32
·
1 Parent(s): 39ac175

Refactor JSON file retrieval in refresh_submissions to improve clarity and ensure correct listing of file names

Browse files
Files changed (1) hide show
  1. gradio_interface.py +5 -3
gradio_interface.py CHANGED
@@ -27,8 +27,9 @@ def refresh_submissions():
27
  if not os.path.exists(hub_path):
28
  os.makedirs(hub_path) # empty repo case
29
  print("os.listdir(hub_path):", os.listdir(hub_path))
30
- json_files = [f.split("/")[-1] for f in glob.glob(hub_path + "/**/*.json", recursive = True) if f.endswith('.json')]
31
- print("Downloaded submissions: ", json_files)
 
32
  submissions = []
33
  for file in json_files:
34
  username, sub_timestamp, task = file.replace(
@@ -119,10 +120,11 @@ upload_button = gr.File(label="Upload JSON", file_types=["json"])
119
  # Create a tabbed interface
120
  with gr.Blocks(title="ImageCLEFmed-MEDVQA-GI-2025 Submissions") as demo:
121
  with gr.Tab("View Submissions"):
 
122
  gr.Interface(
123
  fn=display_submissions,
124
  inputs=[task_type_dropdown, search_box],
125
- outputs=output_table, # Update this line
126
  title="ImageCLEFmed-MEDVQA-GI-2025 Submissions",
127
  description="Filter and search submissions by task type and user."
128
  )
 
27
  if not os.path.exists(hub_path):
28
  os.makedirs(hub_path) # empty repo case
29
  print("os.listdir(hub_path):", os.listdir(hub_path))
30
+ all_jsons = glob.glob(hub_path + "/**/*.json", recursive=True)
31
+ print("Downloaded submissions: ", all_jsons)
32
+ json_files = [f.split("/")[-1] for f in all_jsons]
33
  submissions = []
34
  for file in json_files:
35
  username, sub_timestamp, task = file.replace(
 
120
  # Create a tabbed interface
121
  with gr.Blocks(title="ImageCLEFmed-MEDVQA-GI-2025 Submissions") as demo:
122
  with gr.Tab("View Submissions"):
123
+ gr.Markdown("### Submissions Table")
124
  gr.Interface(
125
  fn=display_submissions,
126
  inputs=[task_type_dropdown, search_box],
127
+ outputs=output_table,
128
  title="ImageCLEFmed-MEDVQA-GI-2025 Submissions",
129
  description="Filter and search submissions by task type and user."
130
  )