Shiyu Zhao commited on
Commit
4903390
·
1 Parent(s): 5d088e6

Update space

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -671,10 +671,12 @@ def process_submission(
671
  except Exception as e:
672
  raise RuntimeError(f"Failed to save files to HuggingFace Hub: {str(e)}")
673
 
674
- # Send confirmation email and update leaderboard
675
  # send_submission_confirmation(meta_data, processed_results)
676
  update_leaderboard_data(submission_data)
677
- demo.update()
 
 
678
 
679
  return f"""
680
  Submission successful!
@@ -704,7 +706,7 @@ def process_submission(
704
  os.unlink(temp_file)
705
  except Exception as e:
706
  print(f"Warning: Failed to delete temporary file {temp_file}: {str(e)}")
707
-
708
  def filter_by_model_type(df, selected_types):
709
  if not selected_types:
710
  return df.head(0)
@@ -867,14 +869,18 @@ with gr.Blocks(css=css) as demo:
867
  )
868
 
869
  submit_btn.click(
870
- process_submission,
871
  inputs=[
872
  method_name, team_name, dataset, split, contact_email,
873
  code_repo, csv_file, model_description, hardware, paper_link
874
  ],
875
- outputs=result
 
 
 
 
876
  )
877
-
878
 
879
  # Launch the application
880
  demo.launch()
 
671
  except Exception as e:
672
  raise RuntimeError(f"Failed to save files to HuggingFace Hub: {str(e)}")
673
 
674
+ # Send confirmation email and update leaderboard data
675
  # send_submission_confirmation(meta_data, processed_results)
676
  update_leaderboard_data(submission_data)
677
+
678
+ # Force a refresh of the model type filter to update the tables
679
+ model_type_filter.update()
680
 
681
  return f"""
682
  Submission successful!
 
706
  os.unlink(temp_file)
707
  except Exception as e:
708
  print(f"Warning: Failed to delete temporary file {temp_file}: {str(e)}")
709
+
710
  def filter_by_model_type(df, selected_types):
711
  if not selected_types:
712
  return df.head(0)
 
869
  )
870
 
871
  submit_btn.click(
872
+ fn=process_submission,
873
  inputs=[
874
  method_name, team_name, dataset, split, contact_email,
875
  code_repo, csv_file, model_description, hardware, paper_link
876
  ],
877
+ outputs=result,
878
+ ).then( # Add a then clause to update the tables after submission
879
+ fn=update_tables,
880
+ inputs=[model_type_filter],
881
+ outputs=all_dfs
882
  )
883
+
884
 
885
  # Launch the application
886
  demo.launch()