Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,8 +11,7 @@ import random
|
|
| 11 |
from Gradio_UI import GradioUI
|
| 12 |
|
| 13 |
|
| 14 |
-
|
| 15 |
-
API_KEY = "TUIRcl9MzEBwR4p3eoF8LmMmwQQXXtPq" # ← replace with your actual key
|
| 16 |
|
| 17 |
api = giphy_client.DefaultApi()
|
| 18 |
|
|
@@ -38,35 +37,6 @@ def get_gif(query: str) -> str:
|
|
| 38 |
print("Giphy API error:", e)
|
| 39 |
return None
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 44 |
-
@tool
|
| 45 |
-
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 46 |
-
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 47 |
-
"""A tool that does nothing yet
|
| 48 |
-
Args:
|
| 49 |
-
arg1: the first argument
|
| 50 |
-
arg2: the second argument
|
| 51 |
-
"""
|
| 52 |
-
return "What magic will you build ?"
|
| 53 |
-
|
| 54 |
-
@tool
|
| 55 |
-
def get_current_time_in_timezone(timezone: str) -> str:
|
| 56 |
-
"""A tool that fetches the current local time in a specified timezone.
|
| 57 |
-
Args:
|
| 58 |
-
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 59 |
-
"""
|
| 60 |
-
try:
|
| 61 |
-
# Create timezone object
|
| 62 |
-
tz = pytz.timezone(timezone)
|
| 63 |
-
# Get current time in that timezone
|
| 64 |
-
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 65 |
-
return f"The current local time in {timezone} is: {local_time}"
|
| 66 |
-
except Exception as e:
|
| 67 |
-
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 68 |
-
|
| 69 |
-
|
| 70 |
final_answer = FinalAnswerTool()
|
| 71 |
|
| 72 |
# 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:
|
|
@@ -88,7 +58,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 88 |
|
| 89 |
agent = CodeAgent(
|
| 90 |
model=model,
|
| 91 |
-
tools=[final_answer,
|
| 92 |
max_steps=6,
|
| 93 |
verbosity_level=1,
|
| 94 |
grammar=None,
|
|
|
|
| 11 |
from Gradio_UI import GradioUI
|
| 12 |
|
| 13 |
|
| 14 |
+
API_KEY = "TUIRcl9MzEBwR4p3eoF8LmMmwQQXXtPq"
|
|
|
|
| 15 |
|
| 16 |
api = giphy_client.DefaultApi()
|
| 17 |
|
|
|
|
| 37 |
print("Giphy API error:", e)
|
| 38 |
return None
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
final_answer = FinalAnswerTool()
|
| 41 |
|
| 42 |
# 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:
|
|
|
|
| 58 |
|
| 59 |
agent = CodeAgent(
|
| 60 |
model=model,
|
| 61 |
+
tools=[final_answer, get_gif], ## add your tools here (don't remove final answer)
|
| 62 |
max_steps=6,
|
| 63 |
verbosity_level=1,
|
| 64 |
grammar=None,
|