Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,6 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 23 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 24 |
|
| 25 |
|
| 26 |
-
|
| 27 |
final_answer = FinalAnswerTool()
|
| 28 |
|
| 29 |
# 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:
|
|
@@ -32,19 +31,23 @@ final_answer = FinalAnswerTool()
|
|
| 32 |
model = HfApiModel(
|
| 33 |
max_tokens=2096,
|
| 34 |
temperature=0.5,
|
| 35 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 36 |
#custom_role_conversions=None,
|
| 37 |
)
|
| 38 |
|
| 39 |
# Import tool from Hub
|
| 40 |
-
|
| 41 |
|
| 42 |
with open("prompts.yaml", 'r') as stream:
|
| 43 |
prompt_templates = yaml.safe_load(stream)
|
| 44 |
|
| 45 |
agent = CodeAgent(
|
| 46 |
model=model,
|
| 47 |
-
tools=[
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
max_steps=6,
|
| 49 |
verbosity_level=1,
|
| 50 |
# grammar=None,
|
|
|
|
| 23 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 24 |
|
| 25 |
|
|
|
|
| 26 |
final_answer = FinalAnswerTool()
|
| 27 |
|
| 28 |
# 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:
|
|
|
|
| 31 |
model = HfApiModel(
|
| 32 |
max_tokens=2096,
|
| 33 |
temperature=0.5,
|
| 34 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 35 |
#custom_role_conversions=None,
|
| 36 |
)
|
| 37 |
|
| 38 |
# Import tool from Hub
|
| 39 |
+
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 40 |
|
| 41 |
with open("prompts.yaml", 'r') as stream:
|
| 42 |
prompt_templates = yaml.safe_load(stream)
|
| 43 |
|
| 44 |
agent = CodeAgent(
|
| 45 |
model=model,
|
| 46 |
+
tools=[
|
| 47 |
+
final_answer,
|
| 48 |
+
get_current_time_in_timezone,
|
| 49 |
+
image_generation_tool
|
| 50 |
+
],
|
| 51 |
max_steps=6,
|
| 52 |
verbosity_level=1,
|
| 53 |
# grammar=None,
|