Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
55 |
# Create timezone object
|
56 |
tz = pytz.timezone(timezone)
|
57 |
# Get current time in that timezone
|
58 |
-
local_time = datetime.
|
59 |
return f"The current local time in {timezone} is: {local_time}"
|
60 |
except Exception as e:
|
61 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
@@ -66,15 +66,15 @@ final_answer = FinalAnswerTool()
|
|
66 |
# 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:
|
67 |
model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
68 |
|
69 |
-
model = HfApiModel(
|
70 |
-
max_tokens=2096,
|
71 |
-
temperature=0.5,
|
72 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
73 |
-
custom_role_conversions=None,
|
74 |
-
)
|
75 |
|
76 |
|
77 |
-
model = LiteLLMModel(model_id="gemini/gemini-2.0-flash-lite", api_key=os.getenv(
|
78 |
|
79 |
# Import tool from Hub
|
80 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
@@ -84,7 +84,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
84 |
|
85 |
agent = CodeAgent(
|
86 |
model=model,
|
87 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
88 |
max_steps=6,
|
89 |
verbosity_level=1,
|
90 |
grammar=None,
|
|
|
55 |
# Create timezone object
|
56 |
tz = pytz.timezone(timezone)
|
57 |
# Get current time in that timezone
|
58 |
+
local_time = datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
59 |
return f"The current local time in {timezone} is: {local_time}"
|
60 |
except Exception as e:
|
61 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
|
|
66 |
# 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:
|
67 |
model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
68 |
|
69 |
+
# model = HfApiModel(
|
70 |
+
# max_tokens=2096,
|
71 |
+
# temperature=0.5,
|
72 |
+
# model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
73 |
+
# custom_role_conversions=None,
|
74 |
+
# )
|
75 |
|
76 |
|
77 |
+
model = LiteLLMModel(model_id="gemini/gemini-2.0-flash-lite", api_key=os.getenv("GEMINI_API_KEY"))
|
78 |
|
79 |
# Import tool from Hub
|
80 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
|
|
84 |
|
85 |
agent = CodeAgent(
|
86 |
model=model,
|
87 |
+
tools=[final_answer, calculate_time_difference, get_current_time_in_timezone, image_generation_tool], ## add your tools here (don't remove final answer)
|
88 |
max_steps=6,
|
89 |
verbosity_level=1,
|
90 |
grammar=None,
|