Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,18 +49,6 @@ class BasicAgent:
|
|
| 49 |
return self.run(question)
|
| 50 |
#return self.agent.run(question)
|
| 51 |
|
| 52 |
-
api_key = os.getenv("HF_TOKEN")
|
| 53 |
-
llm = HuggingFaceInferenceAPI(
|
| 54 |
-
model_name="deepseek-ai/DeepSeek-R1-0528",
|
| 55 |
-
token=api_key,
|
| 56 |
-
provider="auto",
|
| 57 |
-
max_iterations=10
|
| 58 |
-
)
|
| 59 |
-
agent = AgentWorkflow.from_tools_or_functions(
|
| 60 |
-
[wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool,
|
| 61 |
-
round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
|
| 62 |
-
llm=llm
|
| 63 |
-
)
|
| 64 |
|
| 65 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 66 |
"""
|
|
@@ -82,11 +70,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 82 |
submit_url = f"{api_url}/submit"
|
| 83 |
|
| 84 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
#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)
|
| 91 |
agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
|
| 92 |
print(agent_code)
|
|
@@ -153,8 +141,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 153 |
print(f"Error on Task {task_id}: {e}")
|
| 154 |
return answers_payload
|
| 155 |
|
| 156 |
-
answers_payload = asyncio.run(run_all_questions(questions_data))
|
| 157 |
-
|
| 158 |
|
| 159 |
#3B
|
| 160 |
|
|
|
|
| 49 |
return self.run(question)
|
| 50 |
#return self.agent.run(question)
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 54 |
"""
|
|
|
|
| 70 |
submit_url = f"{api_url}/submit"
|
| 71 |
|
| 72 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 73 |
+
try:
|
| 74 |
+
agent = BasicAgent()
|
| 75 |
+
except Exception as e:
|
| 76 |
+
print(f"Error instantiating agent: {e}")
|
| 77 |
+
return f"Error initializing agent: {e}", None
|
| 78 |
#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)
|
| 79 |
agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
|
| 80 |
print(agent_code)
|
|
|
|
| 141 |
print(f"Error on Task {task_id}: {e}")
|
| 142 |
return answers_payload
|
| 143 |
|
| 144 |
+
#answers_payload = asyncio.run(run_all_questions(questions_data))
|
| 145 |
+
answers_payload = run_all_questions(questions_data)
|
| 146 |
|
| 147 |
#3B
|
| 148 |
|