File size: 2,008 Bytes
2f0960b d2a7c88 2f0960b e8d9d9c 2f0960b d2a7c88 2f0960b e8d9d9c 2f0960b d2a7c88 652bf56 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
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"):
with gr.Box():
demo_id = gr.Textbox(DEMO_ID, visible=False)
gr.Dropdown(
value=CodeTask.name,
label="Pick a new Task",
interactive=False,
)
tasks[0].render()
gr.Dropdown(
value=AITask.name,
label="Pick a new Task",
interactive=False,
)
tasks[1].render()
gr.Dropdown(
value=CodeTask.name,
label="Pick a new Task",
interactive=False,
)
tasks[2].render()
gr.Dropdown(
value=AITask.name,
label="Pick a new Task",
interactive=False,
)
tasks[3].render()
demo_buttons(demo_id, tasks)
|