Scott Cogan commited on
Commit
9fd6e24
·
1 Parent(s): 263eda6
Files changed (1) hide show
  1. app.py +10 -17
app.py CHANGED
@@ -229,7 +229,7 @@ class BasicAgent:
229
  return messages["messages"][-1].content if messages["messages"] else fixed_answer
230
 
231
 
232
- def run_and_submit_all( profile: gr.OAuthProfile | None):
233
  """
234
  Fetches all questions, runs the BasicAgent on them, submits all answers,
235
  and displays the results.
@@ -357,7 +357,7 @@ with gr.Blocks() as demo:
357
  """
358
  **Instructions:**
359
  1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
360
- 2. Log in to your Hugging Face account using the button below. This uses your HF username for submission.
361
  3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
362
  ---
363
  **Disclaimers:**
@@ -366,27 +366,20 @@ with gr.Blocks() as demo:
366
  """
367
  )
368
 
369
- with gr.Row():
370
- login_button = gr.LoginButton()
371
- run_button = gr.Button("Run Evaluation & Submit All Answers", interactive=False)
372
 
373
  status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
374
  results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
375
 
376
- def enable_run_button(profile):
377
- if profile:
378
- return gr.Button.update(interactive=True)
379
- return gr.Button.update(interactive=False)
380
-
381
- login_button.click(
382
- fn=enable_run_button,
383
- inputs=[login_button],
384
- outputs=[run_button]
385
- )
386
 
387
  run_button.click(
388
- fn=run_and_submit_all,
389
- inputs=[login_button],
390
  outputs=[status_output, results_table]
391
  )
392
 
 
229
  return messages["messages"][-1].content if messages["messages"] else fixed_answer
230
 
231
 
232
+ def run_and_submit_all( profile: gr.OAuthProfile | None, username: str):
233
  """
234
  Fetches all questions, runs the BasicAgent on them, submits all answers,
235
  and displays the results.
 
357
  """
358
  **Instructions:**
359
  1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
360
+ 2. Enter your Hugging Face username below.
361
  3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
362
  ---
363
  **Disclaimers:**
 
366
  """
367
  )
368
 
369
+ username = gr.Textbox(label="Hugging Face Username", placeholder="Enter your Hugging Face username")
370
+ run_button = gr.Button("Run Evaluation & Submit All Answers")
 
371
 
372
  status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
373
  results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
374
 
375
+ def run_evaluation(username):
376
+ if not username:
377
+ return "Please enter your Hugging Face username.", None
378
+ return run_and_submit_all(None, username)
 
 
 
 
 
 
379
 
380
  run_button.click(
381
+ fn=run_evaluation,
382
+ inputs=[username],
383
  outputs=[status_output, results_table]
384
  )
385