Spaces:
Sleeping
Sleeping
Update app.py
Browse filesEliminate code
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from smolagents import CodeAgent,
|
| 2 |
from shutil import make_archive
|
| 3 |
import datetime
|
| 4 |
import requests
|
|
@@ -139,22 +139,6 @@ def create_zip_package(articles_folder: str, output_zip: str) -> str:
|
|
| 139 |
|
| 140 |
except Exception as e:
|
| 141 |
return f"Error: {str(e)}"
|
| 142 |
-
|
| 143 |
-
@tool
|
| 144 |
-
def get_current_time_in_timezone(timezone: str) -> str:
|
| 145 |
-
"""A tool that fetches the current local time in a specified timezone.
|
| 146 |
-
Args:
|
| 147 |
-
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 148 |
-
"""
|
| 149 |
-
try:
|
| 150 |
-
# Create timezone object
|
| 151 |
-
tz = pytz.timezone(timezone)
|
| 152 |
-
# Get current time in that timezone
|
| 153 |
-
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 154 |
-
return f"The current local time in {timezone} is: {local_time}"
|
| 155 |
-
except Exception as e:
|
| 156 |
-
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 157 |
-
|
| 158 |
|
| 159 |
final_answer = FinalAnswerTool()
|
| 160 |
|
|
@@ -168,9 +152,6 @@ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may
|
|
| 168 |
custom_role_conversions=None,
|
| 169 |
)
|
| 170 |
|
| 171 |
-
# Import tool from Hub
|
| 172 |
-
search_tool = DuckDuckGoSearchTool()
|
| 173 |
-
|
| 174 |
with open("prompts.yaml", 'r') as stream:
|
| 175 |
prompt_templates = yaml.safe_load(stream)
|
| 176 |
|
|
@@ -186,5 +167,4 @@ agent = CodeAgent(
|
|
| 186 |
prompt_templates=prompt_templates
|
| 187 |
)
|
| 188 |
|
| 189 |
-
|
| 190 |
GradioUI(agent).launch()
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, HfApiModel,load_tool,tool
|
| 2 |
from shutil import make_archive
|
| 3 |
import datetime
|
| 4 |
import requests
|
|
|
|
| 139 |
|
| 140 |
except Exception as e:
|
| 141 |
return f"Error: {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
final_answer = FinalAnswerTool()
|
| 144 |
|
|
|
|
| 152 |
custom_role_conversions=None,
|
| 153 |
)
|
| 154 |
|
|
|
|
|
|
|
|
|
|
| 155 |
with open("prompts.yaml", 'r') as stream:
|
| 156 |
prompt_templates = yaml.safe_load(stream)
|
| 157 |
|
|
|
|
| 167 |
prompt_templates=prompt_templates
|
| 168 |
)
|
| 169 |
|
|
|
|
| 170 |
GradioUI(agent).launch()
|