Spaces:
Sleeping
Sleeping
crcdng
commited on
Commit
·
6cebd0e
1
Parent(s):
cadec62
more agents
Browse files- Gradio_UI.py +2 -2
- README.md +5 -3
- app.py +3 -8
Gradio_UI.py
CHANGED
@@ -274,7 +274,7 @@ class GradioUI:
|
|
274 |
}
|
275 |
</style>
|
276 |
<center>
|
277 |
-
<h1 style='font-family: Cyberpunk; font-size: 38px;'> Your
|
278 |
</center>
|
279 |
"""
|
280 |
)
|
@@ -309,7 +309,7 @@ class GradioUI:
|
|
309 |
[stored_messages, text_input],
|
310 |
).then(self.interact_with_agent, [stored_messages, chatbot], [chatbot])
|
311 |
examples = gr.Examples(
|
312 |
-
examples=[["Tell me a joke based on the current local time"],["Given the current local time, what is a fun activity to do?"],["When asked for the current local time, add 6 hours to it. What is the current local time?"]],
|
313 |
inputs=[text_input],
|
314 |
)
|
315 |
demo.launch(debug=True, share=True, allowed_paths=["Cyberpunk.otf"], **kwargs)
|
|
|
274 |
}
|
275 |
</style>
|
276 |
<center>
|
277 |
+
<h1 style='font-family: Cyberpunk; font-size: 38px;'> Your Cyberpunk Local Time Expert </h1>
|
278 |
</center>
|
279 |
"""
|
280 |
)
|
|
|
309 |
[stored_messages, text_input],
|
310 |
).then(self.interact_with_agent, [stored_messages, chatbot], [chatbot])
|
311 |
examples = gr.Examples(
|
312 |
+
examples=[["Tell me a joke based on the current local time"],["Given the current local time, what is a fun activity to do?"],["When asked for the current local time, add 6 hours to it. What is the current local time?"], ["Find significant events that happend exactly one year ago"]],
|
313 |
inputs=[text_input],
|
314 |
)
|
315 |
demo.launch(debug=True, share=True, allowed_paths=["Cyberpunk.otf"], **kwargs)
|
README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
colorTo: yellow
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.15.0
|
@@ -15,4 +15,6 @@ tags:
|
|
15 |
- agent-course
|
16 |
---
|
17 |
|
|
|
|
|
18 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: Your Cyberpunk Local Time Expert
|
3 |
+
emoji: 🤖
|
4 |
+
colorFrom: violet
|
5 |
colorTo: yellow
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.15.0
|
|
|
15 |
- agent-course
|
16 |
---
|
17 |
|
18 |
+
derived from: First Agent Template
|
19 |
+
|
20 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
@@ -34,11 +34,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
|
37 |
-
final_answer = FinalAnswerTool()
|
38 |
-
|
39 |
-
|
40 |
-
# 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:
|
41 |
-
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
42 |
|
43 |
model = HfApiModel(
|
44 |
max_tokens=2096,
|
@@ -47,7 +43,6 @@ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may
|
|
47 |
custom_role_conversions=None,
|
48 |
)
|
49 |
|
50 |
-
|
51 |
# Import tool from Hub
|
52 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
53 |
|
@@ -56,7 +51,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
56 |
|
57 |
agent = CodeAgent(
|
58 |
model=model,
|
59 |
-
tools=[final_answer, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
60 |
max_steps=6,
|
61 |
verbosity_level=1,
|
62 |
grammar=None,
|
|
|
1 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
|
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
|
37 |
+
final_answer = FinalAnswerTool()
|
|
|
|
|
|
|
|
|
38 |
|
39 |
model = HfApiModel(
|
40 |
max_tokens=2096,
|
|
|
43 |
custom_role_conversions=None,
|
44 |
)
|
45 |
|
|
|
46 |
# Import tool from Hub
|
47 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
48 |
|
|
|
51 |
|
52 |
agent = CodeAgent(
|
53 |
model=model,
|
54 |
+
tools=[final_answer, get_current_time_in_timezone, DuckDuckGoSearchTool()], ## add your tools here (don't remove final answer)
|
55 |
max_steps=6,
|
56 |
verbosity_level=1,
|
57 |
grammar=None,
|