Spaces:
Sleeping
Sleeping
Update prompts.yaml
Browse files- prompts.yaml +10 -4
prompts.yaml
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
---
|
| 14 |
Task: "Generate an image of the oldest person in this document."
|
| 15 |
|
| 16 |
-
Thought: I will proceed step by step and use the following tools: `document_qa` to find the oldest person in the document, then `image_generator` to generate an image according to the answer.
|
| 17 |
Code:
|
| 18 |
```py
|
| 19 |
answer = document_qa(document=document, question="Who is the oldest person mentioned?")
|
|
@@ -21,11 +21,17 @@
|
|
| 21 |
```<end_code>
|
| 22 |
Observation: "The oldest person in the document is John Doe, a 55 year old lumberjack living in Newfoundland."
|
| 23 |
|
| 24 |
-
Thought: I will now generate an image showcasing the oldest person.
|
| 25 |
Code:
|
| 26 |
```py
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
```<end_code>
|
| 30 |
|
| 31 |
---
|
|
|
|
| 13 |
---
|
| 14 |
Task: "Generate an image of the oldest person in this document."
|
| 15 |
|
| 16 |
+
Thought: I will proceed step by step and use the following tools: `document_qa` to find the oldest person in the document, then `image_generator` to generate an image according to the answer. I must save the image to disk before calling final_answer.
|
| 17 |
Code:
|
| 18 |
```py
|
| 19 |
answer = document_qa(document=document, question="Who is the oldest person mentioned?")
|
|
|
|
| 21 |
```<end_code>
|
| 22 |
Observation: "The oldest person in the document is John Doe, a 55 year old lumberjack living in Newfoundland."
|
| 23 |
|
| 24 |
+
Thought: I will now generate an image showcasing the oldest person, save it locally, and return the path.
|
| 25 |
Code:
|
| 26 |
```py
|
| 27 |
+
import os
|
| 28 |
+
os.makedirs("generated_images", exist_ok=True)
|
| 29 |
+
|
| 30 |
+
image = image_generator(prompt="A portrait of John Doe, a 55-year-old man living in Canada.")
|
| 31 |
+
path = "generated_images/john_doe.png"
|
| 32 |
+
image.save(path)
|
| 33 |
+
|
| 34 |
+
final_answer(path)
|
| 35 |
```<end_code>
|
| 36 |
|
| 37 |
---
|