Spaces:
Sleeping
Sleeping
1st commit!
Browse files
app.py
CHANGED
|
@@ -7,11 +7,19 @@ 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 !
|
| 11 |
@tool
|
| 12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
-
"""A tool that does nothing yet
|
| 15 |
Args:
|
| 16 |
arg1: the first argument
|
| 17 |
arg2: the second argument
|
|
@@ -37,7 +45,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
| 39 |
# 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:
|
| 40 |
-
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 41 |
|
| 42 |
model = HfApiModel(
|
| 43 |
max_tokens=2096,
|
|
@@ -52,7 +60,7 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
|
|
| 52 |
|
| 53 |
with open("prompts.yaml", 'r') as stream:
|
| 54 |
prompt_templates = yaml.safe_load(stream)
|
| 55 |
-
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
tools=[final_answer], ## add your tools here (don't remove final answer)
|
|
@@ -66,4 +74,4 @@ agent = CodeAgent(
|
|
| 66 |
)
|
| 67 |
|
| 68 |
|
| 69 |
-
GradioUI(agent).launch()
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
+
@tool
|
| 11 |
+
def say_hello() -> str:
|
| 12 |
+
"""A tool that does nothing yet
|
| 13 |
+
Args:
|
| 14 |
+
|
| 15 |
+
"""
|
| 16 |
+
return "Hello, World!!"
|
| 17 |
+
|
| 18 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 19 |
@tool
|
| 20 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 21 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 22 |
+
"""A tool that does nothing yet
|
| 23 |
Args:
|
| 24 |
arg1: the first argument
|
| 25 |
arg2: the second argument
|
|
|
|
| 45 |
final_answer = FinalAnswerTool()
|
| 46 |
|
| 47 |
# 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:
|
| 48 |
+
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 49 |
|
| 50 |
model = HfApiModel(
|
| 51 |
max_tokens=2096,
|
|
|
|
| 60 |
|
| 61 |
with open("prompts.yaml", 'r') as stream:
|
| 62 |
prompt_templates = yaml.safe_load(stream)
|
| 63 |
+
|
| 64 |
agent = CodeAgent(
|
| 65 |
model=model,
|
| 66 |
tools=[final_answer], ## add your tools here (don't remove final answer)
|
|
|
|
| 74 |
)
|
| 75 |
|
| 76 |
|
| 77 |
+
GradioUI(agent).launch()
|