cowrycode commited on
Commit
386cdc0
·
verified ·
1 Parent(s): c411cd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -7
app.py CHANGED
@@ -48,7 +48,30 @@ class BasicAgent:
48
  #return self.agent.run(question)
49
 
50
 
51
- agent = BasicAgent()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- # 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)
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