Synnove commited on
Commit
5ad1f03
·
verified ·
1 Parent(s): 5fe9041

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -11,6 +11,7 @@ from final_answer import FinalAnswerTool
11
  from visit_webpage import VisitWebpageTool
12
  from web_search import web_search_DuckDuckGoSearchTool
13
  from wikipediaLookup import WikipediaLookupTool
 
14
 
15
  api_url = "https://agents-course-unit4-scoring.hf.space"
16
  questions_url = f"{api_url}/questions"
@@ -62,11 +63,12 @@ final_answer = FinalAnswerTool()
62
  visitWebpage = VisitWebpageTool()
63
  wikipediaLookup = WikipediaLookupTool()
64
  webSearch = web_search_DuckDuckGoSearchTool()
 
65
 
66
  #Agent
67
  agent_codeagent = CodeAgent(
68
  model=model,
69
- tools=[final_answer, wikipediaLookup, visitWebpage, webSearch], ## add your tools here (don't remove final answer) duckDuckGoSearch,
70
  max_steps=3,
71
  verbosity_level=1,
72
  grammar=None,
@@ -91,12 +93,12 @@ def run_once(state):
91
  print(f"\nTask ID: {task_id}")
92
  print(f"Question: {question_text}")
93
 
94
- # try:
95
- # answer = agent_codeagent(question_text)
96
- # output = f"Answer to task {task_id}:\n{answer}"
97
- # return output, output
98
- # except Exception as e:
99
- # return f"Error running agent: {e}", None
100
 
101
 
102
 
 
11
  from visit_webpage import VisitWebpageTool
12
  from web_search import web_search_DuckDuckGoSearchTool
13
  from wikipediaLookup import WikipediaLookupTool
14
+ from video_translation import AudioTranscriptionTool
15
 
16
  api_url = "https://agents-course-unit4-scoring.hf.space"
17
  questions_url = f"{api_url}/questions"
 
63
  visitWebpage = VisitWebpageTool()
64
  wikipediaLookup = WikipediaLookupTool()
65
  webSearch = web_search_DuckDuckGoSearchTool()
66
+ video_translation = AudioTranscriptionTool()
67
 
68
  #Agent
69
  agent_codeagent = CodeAgent(
70
  model=model,
71
+ tools=[final_answer, wikipediaLookup, visitWebpage, webSearch, video_translation], ## add your tools here (don't remove final answer) duckDuckGoSearch,
72
  max_steps=3,
73
  verbosity_level=1,
74
  grammar=None,
 
93
  print(f"\nTask ID: {task_id}")
94
  print(f"Question: {question_text}")
95
 
96
+ try:
97
+ answer = agent_codeagent(question_text)
98
+ output = f"Answer to task {task_id}:\n{answer}"
99
+ return output, output
100
+ except Exception as e:
101
+ return f"Error running agent: {e}", None
102
 
103
 
104