Spaces:
Sleeping
Sleeping
Divyam Sharma
commited on
Commit
·
4730f46
1
Parent(s):
01f983e
Adding Generation
Browse files
app.py
CHANGED
|
@@ -78,18 +78,18 @@ demo.launch(share=True)
|
|
| 78 |
|
| 79 |
# ### Let's add generation
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
|
| 91 |
-
|
| 92 |
-
|
| 93 |
|
| 94 |
### Doing it all at once
|
| 95 |
|
|
|
|
| 78 |
|
| 79 |
# ### Let's add generation
|
| 80 |
|
| 81 |
+
with gr.Blocks() as demo:
|
| 82 |
+
gr.Markdown("# Describe-and-Generate game 🖍️")
|
| 83 |
+
image_upload = gr.Image(label="Your first image",type="pil")
|
| 84 |
+
btn_caption = gr.Button("Generate caption")
|
| 85 |
+
caption = gr.Textbox(label="Generated caption")
|
| 86 |
+
btn_image = gr.Button("Generate image")
|
| 87 |
+
image_output = gr.Image(label="Generated Image")
|
| 88 |
+
btn_caption.click(fn=captioner, inputs=[image_upload], outputs=[caption])
|
| 89 |
+
btn_image.click(fn=generate, inputs=[caption], outputs=[image_output])
|
| 90 |
|
| 91 |
+
gr.close_all()
|
| 92 |
+
demo.launch(share=True)
|
| 93 |
|
| 94 |
### Doing it all at once
|
| 95 |
|