Spaces:
Sleeping
Sleeping
Fix UI and evaluation functionality with simplified app.py
Browse files31 unmodified lines323334353637382 unmodified lines41424344454647172 unmodified lines22022122222322422522622722822923023123223323431 unmodified lineslogger.error(traceback.format_exc())return Nonedef run_and_submit_all(profile: Optional[gr.OAuthProfile] = None):"""Fetches all questions, runs the GAIA Agent on them, submits all answers,and displays the results.2 unmodified linesspace_id = os.getenv("SPACE_ID", "")if profile:username = profile.usernamelogger.info(f"User logged in: {username}")else:logger.warning("User not logged in.")172 unmodified lines""")gr.LoginButton()run_button = gr.Button("Run Evaluation & Submit All Answers")status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)run_button.click(fn=run_and_submit_all,outputs=[status_output, results_table])31 unmodified lines32333435363738392 unmodified lines42434445464748172 unmodified lines22122222322422522622722822923023123223323423523623723831 unmodified lineslogger.error(traceback.format_exc())return None# Important: Match the exact signature from the templatedef run_and_submit_all(profile: gr.OAuthProfile | None = None):"""Fetches all questions, runs the GAIA Agent on them, submits all answers,and displays the results.2 unmodified linesspace_id = os.getenv("SPACE_ID", "")if profile:username = f"{profile.username}"logger.info(f"User logged in: {username}")else:logger.warning("User not logged in.")172 unmodified lines""")# Create login button with proper bindinglogin_btn = gr.LoginButton()run_button = gr.Button("Run Evaluation & Submit All Answers")status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)# Connect the login button's user output to the run_and_submit_all function's profile inputrun_button.click(fn=run_and_submit_all,inputs=[login_btn], # Important: Connect login_btn to the function inputoutputs=[status_output, results_table])
app.py+7-3