MEOW commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -140,6 +140,11 @@ def stream_response(message,history):
|
|
| 140 |
yield history + [(message, f"Error processing query: {str(e)}")]
|
| 141 |
|
| 142 |
# Create the Gradio interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
with gr.Blocks() as demo:
|
| 144 |
gr.Markdown("# Multimodal RAG Chatbot 🦀 ")
|
| 145 |
gr.Markdown("Upload **at least** one document, optional to input HTML URL before Q&A")
|
|
@@ -157,7 +162,7 @@ with gr.Blocks() as demo:
|
|
| 157 |
clear = gr.Button("Clear")
|
| 158 |
|
| 159 |
# Set up event handler (Event handlers should be defined within the 'with gr.Blocks() as demo:' block)
|
| 160 |
-
|
| 161 |
msg.submit(stream_response, inputs=[msg, chatbot], outputs=[chatbot]) # Use submit button instead of msg
|
| 162 |
clear.click(lambda: None, None, chatbot, queue=False)
|
| 163 |
|
|
|
|
| 140 |
yield history + [(message, f"Error processing query: {str(e)}")]
|
| 141 |
|
| 142 |
# Create the Gradio interface
|
| 143 |
+
def process_multimodal_uploads(image, text, file):
|
| 144 |
+
# This function would process the inputs as needed. Here's just a placeholder
|
| 145 |
+
# response reflecting what's been uploaded.
|
| 146 |
+
return f"Processed: Image: {'Yes' if image else 'No'}, Text: {text}, File: {file.name if file else 'No file'}"
|
| 147 |
+
|
| 148 |
with gr.Blocks() as demo:
|
| 149 |
gr.Markdown("# Multimodal RAG Chatbot 🦀 ")
|
| 150 |
gr.Markdown("Upload **at least** one document, optional to input HTML URL before Q&A")
|
|
|
|
| 162 |
clear = gr.Button("Clear")
|
| 163 |
|
| 164 |
# Set up event handler (Event handlers should be defined within the 'with gr.Blocks() as demo:' block)
|
| 165 |
+
btn.click(process_multimodal_uploads,inputs=[file_uploader, url_input], outputs=[load_output])
|
| 166 |
msg.submit(stream_response, inputs=[msg, chatbot], outputs=[chatbot]) # Use submit button instead of msg
|
| 167 |
clear.click(lambda: None, None, chatbot, queue=False)
|
| 168 |
|