Spaces:
Runtime error
Runtime error
removed the custom tool
Browse files
app.py
CHANGED
@@ -8,25 +8,6 @@ from PIL import Image
|
|
8 |
|
9 |
from Gradio_UI import GradioUI
|
10 |
|
11 |
-
@tool
|
12 |
-
def image_generator(character:str, sceneDescription:str)-> Image: #it's important 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 returns an image base on a character and a scene setting
|
15 |
-
Args:
|
16 |
-
character: the character
|
17 |
-
sceneDescription: the description of the scene
|
18 |
-
|
19 |
-
Returns:
|
20 |
-
Image: The generated image of the character in the specified scene.
|
21 |
-
"""
|
22 |
-
try:
|
23 |
-
# call the image_generation_tool tool with a text prompt
|
24 |
-
image = image_generation_tool(f"{character} in {sceneDescription}")
|
25 |
-
img = Image.open(BytesIO(image_response.content))
|
26 |
-
return img
|
27 |
-
except Exception as e:
|
28 |
-
return f"Error fetching image for given inputs: {str(e)}"
|
29 |
-
|
30 |
@tool
|
31 |
def get_current_time_in_timezone(timezone: str) -> str:
|
32 |
"""A tool that fetches the current local time in a specified timezone.
|
@@ -65,7 +46,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
65 |
|
66 |
agent = CodeAgent(
|
67 |
model=model,
|
68 |
-
tools=[final_answer,
|
69 |
max_steps=6,
|
70 |
verbosity_level=1,
|
71 |
grammar=None,
|
|
|
8 |
|
9 |
from Gradio_UI import GradioUI
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
@tool
|
12 |
def get_current_time_in_timezone(timezone: str) -> str:
|
13 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
46 |
|
47 |
agent = CodeAgent(
|
48 |
model=model,
|
49 |
+
tools=[final_answer, image_generation_tool], ## add your tools here (don't remove final answer)
|
50 |
max_steps=6,
|
51 |
verbosity_level=1,
|
52 |
grammar=None,
|