jm-vis commited on
Commit
d39f15e
·
1 Parent(s): 0c64865

Fix UI and evaluation functionality with simplified app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -32,7 +32,8 @@ def initialize_agent():
32
  logger.error(traceback.format_exc())
33
  return None
34
 
35
- def run_and_submit_all(profile: Optional[gr.OAuthProfile] = None):
 
36
  """
37
  Fetches all questions, runs the GAIA Agent on them, submits all answers,
38
  and displays the results.
@@ -41,7 +42,7 @@ def run_and_submit_all(profile: Optional[gr.OAuthProfile] = None):
41
  space_id = os.getenv("SPACE_ID", "")
42
 
43
  if profile:
44
- username = profile.username
45
  logger.info(f"User logged in: {username}")
46
  else:
47
  logger.warning("User not logged in.")
@@ -220,15 +221,18 @@ with gr.Blocks() as demo:
220
  """
221
  )
222
 
223
- gr.LoginButton()
 
224
 
225
  run_button = gr.Button("Run Evaluation & Submit All Answers")
226
 
227
  status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
228
  results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
229
 
 
230
  run_button.click(
231
  fn=run_and_submit_all,
 
232
  outputs=[status_output, results_table]
233
  )
234
 
 
32
  logger.error(traceback.format_exc())
33
  return None
34
 
35
+ # Important: Match the exact signature from the template
36
+ def run_and_submit_all(profile: gr.OAuthProfile | None = None):
37
  """
38
  Fetches all questions, runs the GAIA Agent on them, submits all answers,
39
  and displays the results.
 
42
  space_id = os.getenv("SPACE_ID", "")
43
 
44
  if profile:
45
+ username = f"{profile.username}"
46
  logger.info(f"User logged in: {username}")
47
  else:
48
  logger.warning("User not logged in.")
 
221
  """
222
  )
223
 
224
+ # Create login button with proper binding
225
+ login_btn = gr.LoginButton()
226
 
227
  run_button = gr.Button("Run Evaluation & Submit All Answers")
228
 
229
  status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
230
  results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
231
 
232
+ # Connect the login button's user output to the run_and_submit_all function's profile input
233
  run_button.click(
234
  fn=run_and_submit_all,
235
+ inputs=[login_btn], # Important: Connect login_btn to the function input
236
  outputs=[status_output, results_table]
237
  )
238