Spaces:
Build error
Build error
Commit
·
b87663d
1
Parent(s):
873f94b
update
Browse files- app.py +12 -8
- submission/template_submission.py +5 -5
app.py
CHANGED
|
@@ -20,15 +20,19 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# system_prompt_path="prompts/default_system_prompt.txt",
|
| 25 |
# model="gpt-4o",
|
| 26 |
#)
|
| 27 |
-
|
| 28 |
-
agent
|
| 29 |
-
|
| 30 |
-
model="gpt-4o",
|
| 31 |
-
)
|
| 32 |
|
| 33 |
|
| 34 |
|
|
@@ -58,8 +62,8 @@ with gr.Blocks() as demo:
|
|
| 58 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
| 59 |
|
| 60 |
run_button.click(
|
| 61 |
-
|
| 62 |
-
fn=run_and_submit_all, #!! template version
|
| 63 |
outputs=[status_output, results_table]
|
| 64 |
)
|
| 65 |
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
+
|
| 24 |
+
try:
|
| 25 |
+
agent = ReActAgent(
|
| 26 |
+
system_prompt_path="prompts/debugging_prompt.txt",
|
| 27 |
+
model="gpt-4o",
|
| 28 |
+
)
|
| 29 |
+
#agent = DummyAgent(
|
| 30 |
# system_prompt_path="prompts/default_system_prompt.txt",
|
| 31 |
# model="gpt-4o",
|
| 32 |
#)
|
| 33 |
+
except Exception as e:
|
| 34 |
+
print(f"Error instantiating agent: {e}")
|
| 35 |
+
raise e
|
|
|
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
|
|
|
|
| 62 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
| 63 |
|
| 64 |
run_button.click(
|
| 65 |
+
fn=lambda profile:run_and_submit_all_file_download(profile, agent),
|
| 66 |
+
#fn=run_and_submit_all, #!! template version
|
| 67 |
outputs=[status_output, results_table]
|
| 68 |
)
|
| 69 |
|
submission/template_submission.py
CHANGED
|
@@ -27,11 +27,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None, agent: Any) -> tuple[st
|
|
| 27 |
submit_url = f"{api_url}/submit"
|
| 28 |
|
| 29 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 30 |
-
try:
|
| 31 |
-
|
| 32 |
-
except Exception as e:
|
| 33 |
-
|
| 34 |
-
|
| 35 |
# In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)
|
| 36 |
agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
|
| 37 |
print(agent_code)
|
|
|
|
| 27 |
submit_url = f"{api_url}/submit"
|
| 28 |
|
| 29 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 30 |
+
#try:
|
| 31 |
+
# agent = BasicAgent()
|
| 32 |
+
#except Exception as e:
|
| 33 |
+
# print(f"Error instantiating agent: {e}")
|
| 34 |
+
# return f"Error initializing agent: {e}", None
|
| 35 |
# In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)
|
| 36 |
agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
|
| 37 |
print(agent_code)
|