tombetthauser commited on
Commit
36fb421
Β·
1 Parent(s): 7713986

Add kids drawing code

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -1,7 +1,13 @@
1
- import gradio as gr
2
 
3
- def greet(name):
4
- return "Hey buddy " + name + "!!"
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
1
+ import gradio
2
 
3
+ def image_prompt(thing):
4
+ prompt = "A children's drawing of a " + thing
5
+ return pipe(prompt=prompt, height=512, width=664).images[0]
6
 
7
+ with gradio.Blocks() as demo:
8
+ animal = gradio.Textbox(label="A kid's drawing of a...")
9
+ output = gradio.Image(label="Behold...")
10
+ go_button = gradio.Button("Draw it!")
11
+ go_button.click(fn=image_prompt, inputs=animal, outputs=output)
12
+
13
+ demo.launch()