File size: 1,074 Bytes
f7aaf13
 
 
3f55b8d
f7aaf13
f85ee74
cde30f5
f85ee74
2906703
f85ee74
2906703
f85ee74
f7aaf13
6f0fdf8
 
 
3f55b8d
6f0fdf8
a29eec8
6f0fdf8
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr

dictionary = {
     'a playful man': "A young man in his mid-20s to early 30s, Has a playful and energetic demeanor, with a big smile always on his face, Has a lean and athletic build, Has messy, yet stylish hair that is always styled in a way that makes it look like he just got out of bed, Has a playful twinkle in his eye, and a hint of mischief in his expression, Wears casual, comfortable clothing that is both stylish and practical,Often seen with a bag or backpack, as if he's always ready for an adventure"
    }

def chatgpt(query):
    try:
        output = dictionary[query]
    except:
        output = "Please try: https://chat.openai.com"
    return output

with gr.Blocks() as demo:
    gr.Markdown("Start typing below and then click **Run** to see the output.")
    with gr.Row():
        inp = gr.Dropdown(["a playful man", "a trusing woman", "a boy who is bullied"])
        out = gr.Textbox()
    btn = gr.Button("Ask ChatGPT to generate a detailed description.")
    btn.click(fn=chatgpt, inputs=inp, outputs=out)
    

demo.launch()