|
import gradio as gr |
|
import requests |
|
import pandas as pd |
|
from BasicAgent import BasicAgent |
|
|
|
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space" |
|
|
|
def run_and_submit_all(profile: gr.OAuthProfile | None): |
|
|
|
agent = BasicAgent() |
|
question = "What is the meaning of life?" |
|
answer = agent(question) |
|
|
|
|
|
data = [{"Task ID": f"task_{i+1}", "Answer": f"Answer to question {i+1}"} for i in range(5)] |
|
|
|
|
|
return "Results submitted successfully!", pd.DataFrame(data) |
|
|
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("# Basic Agent Evaluation Runner") |
|
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]) |
|
|
|
if __name__ == "__main__": |
|
demo.launch(debug=True, share=False) |
|
|