File size: 1,361 Bytes
2f0960b d2a7c88 2f0960b e8d9d9c 2f0960b d2a7c88 2f0960b e8d9d9c 2f0960b d2a7c88 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import gradio as gr
from components import AITask, CodeTask
from examples import demo_buttons, demo_tasks
DEMO_ID = __name__
tasks = [
CodeTask(
0,
"https://openai.com/",
visible=True,
code_value="Get text from a website. No html. No empty lines. Use the correct headers.",
),
AITask(
1,
"""Your goal is to create an ad for a website.
You will use an AI image generator to generate an image for your ad.
Here is the text from the website:
{t0}
Create a prompt for the AI image generator.
Avoid logos.""",
visible=True,
),
CodeTask(
2,
"{t1}",
visible=True,
code_value="Use openai key <put_your_openai_key_here>. Generate an image from a prompt. Return the url. (not the content)",
),
AITask(
1,
"""Here is the text from a website:
{t0}
Here is a prompt that was used by an AI image generator to generate an image for an ad:
{t1}
Consider the website content and the prompt to create a headline for an ad.""",
visible=True,
),
]
demo_tasks[DEMO_ID] = tasks
def render():
with gr.Tab("Example: Generate an ad"):
demo_id = gr.Textbox(DEMO_ID, visible=False)
tasks[0].render()
tasks[1].render()
tasks[2].render()
tasks[3].render()
demo_buttons(demo_id, tasks)
|