Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,31 +10,11 @@ import pytz # Had to give it permission in Code agent
|
|
| 10 |
from agents.tools import tools
|
| 11 |
|
| 12 |
from check_endpoint import is_huggingface_endpoint
|
|
|
|
| 13 |
|
| 14 |
from Gradio_UI import GradioUI
|
| 15 |
|
| 16 |
|
| 17 |
-
@tool
|
| 18 |
-
def get_the_current_time_in_timezone(timezone: str) -> str:
|
| 19 |
-
|
| 20 |
-
"""A tool that fetches the current local time in a specified timezone.
|
| 21 |
-
Args:
|
| 22 |
-
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 23 |
-
|
| 24 |
-
Returns:
|
| 25 |
-
string: A sentence that provides the time using the 12-hour clock including AM/PM
|
| 26 |
-
"""
|
| 27 |
-
try:
|
| 28 |
-
# Create timezone object
|
| 29 |
-
tz = pytz.timezone(timezone)
|
| 30 |
-
# Get current time in that timezone
|
| 31 |
-
local_time = datetime.datetime.now(tz).strftime("%I:%M %p") # %I for 12-hour clock, %M for minutes, %p for AM/PM
|
| 32 |
-
return f"The current local time in {timezone} is: {local_time}"
|
| 33 |
-
except Exception as e:
|
| 34 |
-
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
my_id = os.getenv("QWEN_URI")
|
| 39 |
|
| 40 |
|
|
@@ -68,15 +48,8 @@ model = LiteLLMModel(
|
|
| 68 |
# Import tool from Hub
|
| 69 |
#image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 70 |
|
| 71 |
-
# Load prompts
|
| 72 |
-
|
| 73 |
-
prompt_templates = yaml.safe_load(stream)
|
| 74 |
-
|
| 75 |
-
# Load contentprompts.yml
|
| 76 |
-
with open("contentprompts.yml", 'r') as stream:
|
| 77 |
-
content_prompts = yaml.safe_load(stream)
|
| 78 |
-
|
| 79 |
-
combined_prompts = {**prompt_templates, **content_prompts}
|
| 80 |
|
| 81 |
|
| 82 |
# web_search, visit_webpage
|
|
|
|
| 10 |
from agents.tools import tools
|
| 11 |
|
| 12 |
from check_endpoint import is_huggingface_endpoint
|
| 13 |
+
from agents.prompts import load_prompts
|
| 14 |
|
| 15 |
from Gradio_UI import GradioUI
|
| 16 |
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
my_id = os.getenv("QWEN_URI")
|
| 19 |
|
| 20 |
|
|
|
|
| 48 |
# Import tool from Hub
|
| 49 |
#image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 50 |
|
| 51 |
+
# Load prompts
|
| 52 |
+
combined_prompts = load_prompts()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
|
| 55 |
# web_search, visit_webpage
|