Spaces:
Runtime error
Runtime error
Hannah
commited on
Commit
·
65e088f
1
Parent(s):
3b7d6da
add clear btn
Browse files
app.py
CHANGED
|
@@ -21,10 +21,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 21 |
image = gr.Image(sources=["upload", "clipboard"], type="filepath", height=330)
|
| 22 |
additional_context = gr.Textbox(interactive=True, label="Add additional context here (optional)")
|
| 23 |
submit_btn = gr.Button("Submit", variant="primary")
|
|
|
|
| 24 |
|
| 25 |
response = gr.Textbox(label="Answer")
|
| 26 |
|
| 27 |
submit_btn.click(get_caption, [image, additional_context], outputs=[response])
|
|
|
|
| 28 |
|
| 29 |
if __name__ == "__main__":
|
| 30 |
demo.launch()
|
|
|
|
| 21 |
image = gr.Image(sources=["upload", "clipboard"], type="filepath", height=330)
|
| 22 |
additional_context = gr.Textbox(interactive=True, label="Add additional context here (optional)")
|
| 23 |
submit_btn = gr.Button("Submit", variant="primary")
|
| 24 |
+
clear_btn = gr.Button("Clear", variant="secondary")
|
| 25 |
|
| 26 |
response = gr.Textbox(label="Answer")
|
| 27 |
|
| 28 |
submit_btn.click(get_caption, [image, additional_context], outputs=[response])
|
| 29 |
+
clear_btn.click(lambda x: "", [response], outputs=[response])
|
| 30 |
|
| 31 |
if __name__ == "__main__":
|
| 32 |
demo.launch()
|