Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,8 @@ import pytz
|
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
|
|
|
|
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
@@ -18,6 +20,17 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@tool
|
| 22 |
def my_party_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 23 |
"""A tool that recomends the party type and the place for event
|
|
@@ -86,7 +99,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 86 |
|
| 87 |
agent = CodeAgent(
|
| 88 |
model=model,
|
| 89 |
-
tools=[final_answer, image_generation_tool, my_party_tool, DuckDuckGoSearchTool(), get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
| 90 |
max_steps=6,
|
| 91 |
verbosity_level=1,
|
| 92 |
grammar=None,
|
|
|
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
+
from transformers import pipeline # for creating answer by emoji
|
| 9 |
+
|
| 10 |
from Gradio_UI import GradioUI
|
| 11 |
|
| 12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
| 20 |
"""
|
| 21 |
return "What magic will you build ?"
|
| 22 |
|
| 23 |
+
@tool
|
| 24 |
+
def emoji(arg1:str)-> str: #it's import to specify the return type
|
| 25 |
+
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 26 |
+
"""A tool that translate a usual string into emoji
|
| 27 |
+
Args:
|
| 28 |
+
arg1: the string to be translated
|
| 29 |
+
"""
|
| 30 |
+
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-emoji")
|
| 31 |
+
|
| 32 |
+
return translator(arg1)
|
| 33 |
+
|
| 34 |
@tool
|
| 35 |
def my_party_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 36 |
"""A tool that recomends the party type and the place for event
|
|
|
|
| 99 |
|
| 100 |
agent = CodeAgent(
|
| 101 |
model=model,
|
| 102 |
+
tools=[final_answer, image_generation_tool, my_party_tool, emoji, DuckDuckGoSearchTool(), get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
| 103 |
max_steps=6,
|
| 104 |
verbosity_level=1,
|
| 105 |
grammar=None,
|