Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import requests
|
4 |
-
import inspect
|
5 |
import pandas as pd
|
6 |
from agent import DuckDuckGoAgent
|
7 |
|
@@ -20,7 +19,7 @@ class BasicAgent:
|
|
20 |
|
21 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
22 |
"""
|
23 |
-
Fetches all questions, runs the
|
24 |
and displays the results.
|
25 |
"""
|
26 |
space_id = os.getenv("SPACE_ID")
|
@@ -38,7 +37,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
38 |
|
39 |
# 1. Instantiate Agent
|
40 |
try:
|
41 |
-
agent = DuckDuckGoAgent()
|
42 |
except Exception as e:
|
43 |
print(f"Error instantiating agent: {e}")
|
44 |
return f"Error initializing agent: {e}", None
|
@@ -71,7 +70,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
71 |
print(f"Skipping item with missing task_id or question: {item}")
|
72 |
continue
|
73 |
try:
|
74 |
-
submitted_answer = agent(question_text)
|
75 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
76 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
77 |
except Exception as e:
|
@@ -100,7 +99,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
100 |
|
101 |
# --- Build Gradio Interface using Blocks ---
|
102 |
with gr.Blocks() as demo:
|
103 |
-
gr.Markdown("#
|
104 |
gr.Markdown(
|
105 |
"""
|
106 |
**Instructions:**
|
@@ -146,5 +145,5 @@ if __name__ == "__main__":
|
|
146 |
|
147 |
print("-"*(60 + len(" App Starting ")) + "\n")
|
148 |
|
149 |
-
print("Launching Gradio Interface for
|
150 |
demo.launch(debug=True, share=False)
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import requests
|
|
|
4 |
import pandas as pd
|
5 |
from agent import DuckDuckGoAgent
|
6 |
|
|
|
19 |
|
20 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
21 |
"""
|
22 |
+
Fetches all questions, runs the DuckDuckGoAgent on them, submits all answers,
|
23 |
and displays the results.
|
24 |
"""
|
25 |
space_id = os.getenv("SPACE_ID")
|
|
|
37 |
|
38 |
# 1. Instantiate Agent
|
39 |
try:
|
40 |
+
agent = DuckDuckGoAgent() # Instanciando DuckDuckGoAgent
|
41 |
except Exception as e:
|
42 |
print(f"Error instantiating agent: {e}")
|
43 |
return f"Error initializing agent: {e}", None
|
|
|
70 |
print(f"Skipping item with missing task_id or question: {item}")
|
71 |
continue
|
72 |
try:
|
73 |
+
submitted_answer = agent(question_text) # Usando el agente DuckDuckGo
|
74 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
75 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
76 |
except Exception as e:
|
|
|
99 |
|
100 |
# --- Build Gradio Interface using Blocks ---
|
101 |
with gr.Blocks() as demo:
|
102 |
+
gr.Markdown("# DuckDuckGo Agent Evaluation Runner")
|
103 |
gr.Markdown(
|
104 |
"""
|
105 |
**Instructions:**
|
|
|
145 |
|
146 |
print("-"*(60 + len(" App Starting ")) + "\n")
|
147 |
|
148 |
+
print("Launching Gradio Interface for DuckDuckGo Agent Evaluation...")
|
149 |
demo.launch(debug=True, share=False)
|