Spaces:
Sleeping
Sleeping
Feat: Image generation tool
Browse files
app.py
CHANGED
|
@@ -66,6 +66,19 @@ def analyze_species_difference(species1: str, species2: str) -> str:
|
|
| 66 |
return f"Based on the research, here's a comparison between {species1} and {species2}"
|
| 67 |
else:
|
| 68 |
return f"Sorry, I couldn't find information on the physiological differences between {species1} and {species2}. Please, try another query."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
@tool
|
| 71 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -104,7 +117,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 104 |
|
| 105 |
agent = CodeAgent(
|
| 106 |
model=model,
|
| 107 |
-
tools=[final_answer, get_star_trek_quote, analyze_species_difference], ## add your tools here (don't remove final answer)
|
| 108 |
max_steps=6,
|
| 109 |
verbosity_level=1,
|
| 110 |
grammar=None,
|
|
|
|
| 66 |
return f"Based on the research, here's a comparison between {species1} and {species2}"
|
| 67 |
else:
|
| 68 |
return f"Sorry, I couldn't find information on the physiological differences between {species1} and {species2}. Please, try another query."
|
| 69 |
+
|
| 70 |
+
@tool
|
| 71 |
+
def generate_starship_image(starship_class: str) -> str:
|
| 72 |
+
"""
|
| 73 |
+
Generate an image of a Star Trek starship based on the starship class.
|
| 74 |
+
"""
|
| 75 |
+
prompt = f"Generate a digital image of Star Trek starship of the {starship_class} class."
|
| 76 |
+
|
| 77 |
+
try:
|
| 78 |
+
image_url = image_generation_tool(prompt)
|
| 79 |
+
return f"Here is the image of a {starship_class} class starship: {image_url}"
|
| 80 |
+
except Exception as e:
|
| 81 |
+
return f"Error generating image for {starship_class} class starship: {str(e)}"
|
| 82 |
|
| 83 |
@tool
|
| 84 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 117 |
|
| 118 |
agent = CodeAgent(
|
| 119 |
model=model,
|
| 120 |
+
tools=[final_answer, get_star_trek_quote, analyze_species_difference, generate_starship_image], ## add your tools here (don't remove final answer)
|
| 121 |
max_steps=6,
|
| 122 |
verbosity_level=1,
|
| 123 |
grammar=None,
|