Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,11 +11,10 @@ from Gradio_UI import GradioUI
|
|
| 11 |
|
| 12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 13 |
@tool
|
| 14 |
-
def destiny_still_arrives(
|
| 15 |
# Keep this format for the description / args / args description but feel free to modify the tool
|
| 16 |
-
"""A tool that takes a
|
| 17 |
Args:
|
| 18 |
-
name: A string representing a person's name
|
| 19 |
dob: A string representing a person's date of birth
|
| 20 |
"""
|
| 21 |
|
|
@@ -36,43 +35,10 @@ def destiny_still_arrives(name:str, dob:str)-> str: #it's import to specify the
|
|
| 36 |
|
| 37 |
month = datetime.strptime(dob, "%Y-%m-%d").strftime("%B")
|
| 38 |
birthstone = birthstones.get(month, "Unknown")
|
| 39 |
-
|
| 40 |
-
# model = HfApiModel(
|
| 41 |
-
# max_tokens=2096,
|
| 42 |
-
# temperature=0.5,
|
| 43 |
-
# model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 44 |
-
# custom_role_conversions=None,
|
| 45 |
-
# )
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
# # Import tool from Hub
|
| 49 |
-
# image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 50 |
-
|
| 51 |
-
# with open("prompts.yaml", 'r') as stream:
|
| 52 |
-
# prompt_templates = yaml.safe_load(stream)
|
| 53 |
-
|
| 54 |
-
# agent = CodeAgent(
|
| 55 |
-
# model=model,
|
| 56 |
-
# tools=[final_answer,image_generation_tool,DuckDuckGoSearchTool()], ## add your tools here (don't remove final answer)
|
| 57 |
-
# max_steps=6,
|
| 58 |
-
# verbosity_level=1,
|
| 59 |
-
# grammar=None,
|
| 60 |
-
# planning_interval=None,
|
| 61 |
-
# name=None,
|
| 62 |
-
# description=None,
|
| 63 |
-
# prompt_templates=prompt_templates
|
| 64 |
-
# )
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
# # if birthstone in image_urls:
|
| 69 |
-
# response = agent.run(f"Please find out the meaning of the following name: {name}, then Generate an image of the following birthstone: {birthstone} and finally a horoscope reading of the current day")
|
| 70 |
-
# else:
|
| 71 |
-
# response = agent.run(f"Please find out the meaning of the following name: {name}, then finally a horoscope reading of the current day")
|
| 72 |
if birthstone in image_urls:
|
| 73 |
-
response =
|
| 74 |
else:
|
| 75 |
-
response =
|
| 76 |
return response
|
| 77 |
|
| 78 |
@tool
|
|
@@ -112,7 +78,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 112 |
|
| 113 |
agent = CodeAgent(
|
| 114 |
model=model,
|
| 115 |
-
tools=[final_answer, get_current_time_in_timezone,image_generation_tool,destiny_still_arrives,
|
| 116 |
max_steps=6,
|
| 117 |
verbosity_level=1,
|
| 118 |
grammar=None,
|
|
|
|
| 11 |
|
| 12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 13 |
@tool
|
| 14 |
+
def destiny_still_arrives(dob:str)-> str: #it's import to specify the return type
|
| 15 |
# Keep this format for the description / args / args description but feel free to modify the tool
|
| 16 |
+
"""A tool that takes a date of birth as input. It outputs the birthstone of that month present in the date of birth
|
| 17 |
Args:
|
|
|
|
| 18 |
dob: A string representing a person's date of birth
|
| 19 |
"""
|
| 20 |
|
|
|
|
| 35 |
|
| 36 |
month = datetime.strptime(dob, "%Y-%m-%d").strftime("%B")
|
| 37 |
birthstone = birthstones.get(month, "Unknown")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
if birthstone in image_urls:
|
| 39 |
+
response = birthstone
|
| 40 |
else:
|
| 41 |
+
response = "Unknown"
|
| 42 |
return response
|
| 43 |
|
| 44 |
@tool
|
|
|
|
| 78 |
|
| 79 |
agent = CodeAgent(
|
| 80 |
model=model,
|
| 81 |
+
tools=[final_answer, get_current_time_in_timezone,image_generation_tool,destiny_still_arrives, ## add your tools here (don't remove final answer)
|
| 82 |
max_steps=6,
|
| 83 |
verbosity_level=1,
|
| 84 |
grammar=None,
|