Upload run_prompt_template.txt with huggingface_hub
Browse files- run_prompt_template.txt +75 -0
run_prompt_template.txt
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
I will ask you to perform a task, your job is to come up with a series of simple commands in Python that will perform the task.
|
2 |
+
To help you, I will give you access to a set of tools that you can use. Each tool is a Python function and has a description explaining the task it performs, the inputs it expects and the outputs it returns.
|
3 |
+
You should first explain which tool you will use to perform the task and for what reason, then write the code in Python.
|
4 |
+
Each instruction in Python should be a simple assignment. You can print intermediate results if it makes sense to do so.
|
5 |
+
|
6 |
+
Tools:
|
7 |
+
<<all_tools>>
|
8 |
+
|
9 |
+
|
10 |
+
Task: "Answer the question in the variable `question` about the image stored in the variable `image`. The question is in French."
|
11 |
+
|
12 |
+
I will use the following tools: `translator` to translate the question into English and then `image_qa` to answer the question on the input image.
|
13 |
+
|
14 |
+
Answer:
|
15 |
+
```py
|
16 |
+
translated_question = translator(question=question, src_lang="French", tgt_lang="English")
|
17 |
+
print(f"The translated question is {translated_question}.")
|
18 |
+
answer = image_qa(image=image, question=translated_question)
|
19 |
+
print(f"The answer is {answer}")
|
20 |
+
```
|
21 |
+
|
22 |
+
Task: "Identify the oldest person in the `document` and create an image showcasing the result."
|
23 |
+
|
24 |
+
I will 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.
|
25 |
+
|
26 |
+
Answer:
|
27 |
+
```py
|
28 |
+
answer = document_qa(document, question="What is the oldest person?")
|
29 |
+
print(f"The answer is {answer}.")
|
30 |
+
image = image_generator(answer)
|
31 |
+
```
|
32 |
+
|
33 |
+
Task: "Generate an image using the text given in the variable `caption`."
|
34 |
+
|
35 |
+
I will use the following tool: `image_generator` to generate an image.
|
36 |
+
|
37 |
+
Answer:
|
38 |
+
```py
|
39 |
+
image = image_generator(prompt=caption)
|
40 |
+
```
|
41 |
+
|
42 |
+
Task: "Summarize the text given in the variable `text` and read it out loud."
|
43 |
+
|
44 |
+
I will use the following tools: `summarizer` to create a summary of the input text, then `text_reader` to read it out loud.
|
45 |
+
|
46 |
+
Answer:
|
47 |
+
```py
|
48 |
+
summarized_text = summarizer(text)
|
49 |
+
print(f"Summary: {summarized_text}")
|
50 |
+
audio_summary = text_reader(summarized_text)
|
51 |
+
```
|
52 |
+
|
53 |
+
Task: "Answer the question in the variable `question` about the text in the variable `text`. Use the answer to generate an image."
|
54 |
+
|
55 |
+
I will use the following tools: `text_qa` to create the answer, then `image_generator` to generate an image according to the answer.
|
56 |
+
|
57 |
+
Answer:
|
58 |
+
```py
|
59 |
+
answer = text_qa(text=text, question=question)
|
60 |
+
print(f"The answer is {answer}.")
|
61 |
+
image = image_generator(answer)
|
62 |
+
```
|
63 |
+
|
64 |
+
Task: "Caption the following `image`."
|
65 |
+
|
66 |
+
I will use the following tool: `image_captioner` to generate a caption for the image.
|
67 |
+
|
68 |
+
Answer:
|
69 |
+
```py
|
70 |
+
caption = image_captioner(image)
|
71 |
+
```
|
72 |
+
|
73 |
+
Task: "<<prompt>>"
|
74 |
+
|
75 |
+
I will use the following
|