Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,34 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import requests
|
3 |
+
import pandas as pd
|
4 |
+
from BasicAgent import BasicAgent # Import BasicAgent class
|
5 |
+
|
6 |
+
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
7 |
+
|
8 |
+
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
9 |
+
# Your logic for fetching and submitting data here
|
10 |
+
agent = BasicAgent()
|
11 |
+
question = "What is the meaning of life?" # Example question, you can modify this
|
12 |
+
answer = agent(question) # Get answer from BasicAgent
|
13 |
+
|
14 |
+
# Mocking data as if agent has answered some questions
|
15 |
+
data = [{"Task ID": f"task_{i+1}", "Answer": f"Answer to question {i+1}"} for i in range(5)]
|
16 |
+
|
17 |
+
# You can modify the status and table as per your needs
|
18 |
+
return "Results submitted successfully!", pd.DataFrame(data)
|
19 |
+
|
20 |
+
# Initialize Gradio interface
|
21 |
+
with gr.Blocks() as demo:
|
22 |
+
gr.Markdown("# Basic Agent Evaluation Runner")
|
23 |
+
gr.LoginButton()
|
24 |
+
|
25 |
+
# Add run button and result output fields
|
26 |
+
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
27 |
+
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
28 |
+
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
29 |
+
|
30 |
+
# Hook up button click to function
|
31 |
+
run_button.click(fn=run_and_submit_all, outputs=[status_output, results_table])
|
32 |
+
|
33 |
+
if __name__ == "__main__":
|
34 |
+
demo.launch(debug=True, share=False)
|