Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ def create_new_vday_card_tool(theme:str) -> str: #it's import to specify the ret
|
|
| 25 |
description="Generate image from prompt"
|
| 26 |
)
|
| 27 |
'''
|
| 28 |
-
if re.search("Valentine's Day card",
|
| 29 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 30 |
image = image_generation_tool(theme)
|
| 31 |
return final_answer(image)
|
|
@@ -34,23 +34,6 @@ def create_new_vday_card_tool(theme:str) -> str: #it's import to specify the ret
|
|
| 34 |
except Exception as e:
|
| 35 |
return f"Error creating card for theme '{theme}': {str(e)}"
|
| 36 |
|
| 37 |
-
'''
|
| 38 |
-
@tool
|
| 39 |
-
def get_current_time_in_timezone(timezone: str) -> str:
|
| 40 |
-
"""A tool that fetches the current local time in a specified timezone.
|
| 41 |
-
Args:
|
| 42 |
-
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 43 |
-
"""
|
| 44 |
-
try:
|
| 45 |
-
# Create timezone object
|
| 46 |
-
tz = pytz.timezone(timezone)
|
| 47 |
-
# Get current time in that timezone
|
| 48 |
-
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 49 |
-
return f"The current local time in {timezone} is: {local_time}"
|
| 50 |
-
except Exception as e:
|
| 51 |
-
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 52 |
-
'''
|
| 53 |
-
|
| 54 |
final_answer = FinalAnswerTool()
|
| 55 |
|
| 56 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
|
|
|
| 25 |
description="Generate image from prompt"
|
| 26 |
)
|
| 27 |
'''
|
| 28 |
+
if re.search("Valentine's Day card", theme) != None:
|
| 29 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 30 |
image = image_generation_tool(theme)
|
| 31 |
return final_answer(image)
|
|
|
|
| 34 |
except Exception as e:
|
| 35 |
return f"Error creating card for theme '{theme}': {str(e)}"
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
| 39 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|