Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,7 +48,30 @@ class BasicAgent:
|
|
| 48 |
#return self.agent.run(question)
|
| 49 |
|
| 50 |
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 54 |
"""
|
|
@@ -70,12 +93,12 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 70 |
submit_url = f"{api_url}/submit"
|
| 71 |
|
| 72 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
#
|
| 79 |
agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
|
| 80 |
print(agent_code)
|
| 81 |
|
|
|
|
| 48 |
#return self.agent.run(question)
|
| 49 |
|
| 50 |
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
# START MY CODE
|
| 58 |
+
|
| 59 |
+
print("BasicAgent initialized.")
|
| 60 |
+
api_key = os.getenv("HF_TOKEN")
|
| 61 |
+
llm = HuggingFaceInferenceAPI(
|
| 62 |
+
model_name="deepseek-ai/DeepSeek-R1-0528",
|
| 63 |
+
token=self.api_key,
|
| 64 |
+
provider="auto",
|
| 65 |
+
max_iterations=10,
|
| 66 |
+
max_execution_time=60
|
| 67 |
+
)
|
| 68 |
+
agent = AgentWorkflow.from_tools_or_functions(
|
| 69 |
+
[wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool,
|
| 70 |
+
round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
|
| 71 |
+
llm=self.llm
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
# END MY CODE
|
| 75 |
|
| 76 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 77 |
"""
|
|
|
|
| 93 |
submit_url = f"{api_url}/submit"
|
| 94 |
|
| 95 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 96 |
+
try:
|
| 97 |
+
#agent = BasicAgent()
|
| 98 |
+
except Exception as e:
|
| 99 |
+
print(f"Error instantiating agent: {e}")
|
| 100 |
+
return f"Error initializing agent: {e}", None
|
| 101 |
+
#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)
|
| 102 |
agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
|
| 103 |
print(agent_code)
|
| 104 |
|