Add clear button
Browse files
app.py
CHANGED
|
@@ -107,13 +107,14 @@ def handle_query(text_input, image_input):
|
|
| 107 |
def launch_app():
|
| 108 |
with gr.Blocks() as demo:
|
| 109 |
gr.Markdown("## 📄🎓Multimodal Chatbot for FAST-NUCES")
|
| 110 |
-
|
| 111 |
with gr.Row():
|
| 112 |
text_input = gr.Textbox(label="Enter your query")
|
| 113 |
image_input = gr.Image(label="Upload an image", type="pil")
|
| 114 |
|
| 115 |
with gr.Row():
|
| 116 |
btn = gr.Button("Submit")
|
|
|
|
| 117 |
|
| 118 |
gr.Markdown("### 🧠 LLM Response:")
|
| 119 |
answer_output = gr.Markdown()
|
|
@@ -121,7 +122,11 @@ def launch_app():
|
|
| 121 |
with gr.Accordion("📚 Source References", open=False):
|
| 122 |
reference_output = gr.Markdown()
|
| 123 |
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
demo.launch()
|
| 127 |
|
|
|
|
| 107 |
def launch_app():
|
| 108 |
with gr.Blocks() as demo:
|
| 109 |
gr.Markdown("## 📄🎓Multimodal Chatbot for FAST-NUCES")
|
| 110 |
+
|
| 111 |
with gr.Row():
|
| 112 |
text_input = gr.Textbox(label="Enter your query")
|
| 113 |
image_input = gr.Image(label="Upload an image", type="pil")
|
| 114 |
|
| 115 |
with gr.Row():
|
| 116 |
btn = gr.Button("Submit")
|
| 117 |
+
btn_clear = gr.Button("Clear")
|
| 118 |
|
| 119 |
gr.Markdown("### 🧠 LLM Response:")
|
| 120 |
answer_output = gr.Markdown()
|
|
|
|
| 122 |
with gr.Accordion("📚 Source References", open=False):
|
| 123 |
reference_output = gr.Markdown()
|
| 124 |
|
| 125 |
+
# Submit button
|
| 126 |
+
btn.click(fn=handle_query,inputs=[text_input, image_input],outputs=[answer_output, reference_output])
|
| 127 |
+
|
| 128 |
+
# Clear button
|
| 129 |
+
btn_clear.click(fn=lambda: ("", None, "", ""),inputs=[],outputs=[text_input, image_input, answer_output, reference_output])
|
| 130 |
|
| 131 |
demo.launch()
|
| 132 |
|