Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,8 +86,7 @@ def generate_passover_coloring_pages(age: int) -> str:
|
|
| 86 |
response += "\n".join(descriptions)
|
| 87 |
|
| 88 |
# Return the response with image paths
|
| 89 |
-
|
| 90 |
-
return f"{response}\n\nImages are saved and ready for display."
|
| 91 |
except Exception as e:
|
| 92 |
# If image generation fails, return text description
|
| 93 |
response = f"## Passover Coloring Pages for a {age}-year-old:\n\n"
|
|
@@ -162,10 +161,9 @@ When a user enters a number between 1 and 12, interpret it as the age of a child
|
|
| 162 |
If you're asked to generate coloring pages or if the input is just a number, assume the user wants Passover coloring pages for a child of that age.
|
| 163 |
|
| 164 |
To use a tool, output an action in this format:
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
action = tool_name(arg1=value1, arg2=value2, ...)
|
|
|
|
| 169 |
|
| 170 |
Always use Python syntax for calling tools. After using a tool, analyze the result to determine what to do next. Use final_answer to return your answer when complete.
|
| 171 |
""",
|
|
@@ -186,9 +184,7 @@ model = HfApiModel(
|
|
| 186 |
try:
|
| 187 |
with open("prompts.yaml", 'r') as stream:
|
| 188 |
prompt_templates = yaml.safe_load(stream)
|
| 189 |
-
# Merge
|
| 190 |
-
|
| 191 |
-
e templates, giving priority to our custom ones
|
| 192 |
prompt_templates.update(custom_prompt_templates)
|
| 193 |
except:
|
| 194 |
# If file doesn't exist or has issues, use our custom templates
|
|
|
|
| 86 |
response += "\n".join(descriptions)
|
| 87 |
|
| 88 |
# Return the response with image paths
|
| 89 |
+
return f"{response}\n\nImages are saved and ready for display."
|
|
|
|
| 90 |
except Exception as e:
|
| 91 |
# If image generation fails, return text description
|
| 92 |
response = f"## Passover Coloring Pages for a {age}-year-old:\n\n"
|
|
|
|
| 161 |
If you're asked to generate coloring pages or if the input is just a number, assume the user wants Passover coloring pages for a child of that age.
|
| 162 |
|
| 163 |
To use a tool, output an action in this format:
|
| 164 |
+
```py
|
|
|
|
|
|
|
| 165 |
action = tool_name(arg1=value1, arg2=value2, ...)
|
| 166 |
+
```
|
| 167 |
|
| 168 |
Always use Python syntax for calling tools. After using a tool, analyze the result to determine what to do next. Use final_answer to return your answer when complete.
|
| 169 |
""",
|
|
|
|
| 184 |
try:
|
| 185 |
with open("prompts.yaml", 'r') as stream:
|
| 186 |
prompt_templates = yaml.safe_load(stream)
|
| 187 |
+
# Merge the templates, giving priority to our custom ones
|
|
|
|
|
|
|
| 188 |
prompt_templates.update(custom_prompt_templates)
|
| 189 |
except:
|
| 190 |
# If file doesn't exist or has issues, use our custom templates
|