Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -172,10 +172,10 @@ class BasicAgent:
|
|
| 172 |
return self.format_final_answer("COULD_NOT_SOLVE")
|
| 173 |
|
| 174 |
# --- Evaluation Logic ---
|
| 175 |
-
def run_and_submit_all(profile
|
| 176 |
space_id = os.getenv("SPACE_ID")
|
| 177 |
if profile:
|
| 178 |
-
username = profile
|
| 179 |
print(f"User logged in: {username}")
|
| 180 |
else:
|
| 181 |
return "Please Login to Hugging Face with the button.", None
|
|
@@ -249,21 +249,11 @@ with gr.Blocks() as demo:
|
|
| 249 |
3. Click the button to run evaluation and submit your answers.
|
| 250 |
"""
|
| 251 |
)
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
test_checkbox = gr.Checkbox(label="Enable Test Mode (Skip Submission)", value=False)
|
| 255 |
-
run_button = gr.Button("Run Evaluation")
|
| 256 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
| 257 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
| 258 |
-
|
| 259 |
-
# Simulate OAuth Profile with a mock profile for now
|
| 260 |
-
mock_oauth_profile = gr.Textbox(label="Simulated OAuth Profile", value="mock_user", interactive=False)
|
| 261 |
-
|
| 262 |
-
run_button.click(
|
| 263 |
-
fn=run_and_submit_all,
|
| 264 |
-
inputs=[mock_oauth_profile, test_checkbox],
|
| 265 |
-
outputs=[status_output, results_table]
|
| 266 |
-
)
|
| 267 |
|
| 268 |
if __name__ == "__main__":
|
| 269 |
print("Launching Gradio Interface...")
|
|
|
|
| 172 |
return self.format_final_answer("COULD_NOT_SOLVE")
|
| 173 |
|
| 174 |
# --- Evaluation Logic ---
|
| 175 |
+
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
| 176 |
space_id = os.getenv("SPACE_ID")
|
| 177 |
if profile:
|
| 178 |
+
username = profile.username
|
| 179 |
print(f"User logged in: {username}")
|
| 180 |
else:
|
| 181 |
return "Please Login to Hugging Face with the button.", None
|
|
|
|
| 249 |
3. Click the button to run evaluation and submit your answers.
|
| 250 |
"""
|
| 251 |
)
|
| 252 |
+
gr.LoginButton()
|
| 253 |
+
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
|
|
|
|
|
|
| 254 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
| 255 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
| 256 |
+
run_button.click(fn=run_and_submit_all, outputs=[status_output, results_table])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
|
| 258 |
if __name__ == "__main__":
|
| 259 |
print("Launching Gradio Interface...")
|