Update app.py
Browse files
app.py
CHANGED
|
@@ -179,7 +179,7 @@ class MultimodalChatbot:
|
|
| 179 |
prompt = f"<image_soft_token> {text_input}" if text_input else "<image_soft_token> Describe this image"
|
| 180 |
output = self.pipe(image, text=prompt)
|
| 181 |
description = output[0]['generated_text']
|
| 182 |
-
content_parts.append({"type": "text", "text": f"Image analysis: {description}"})
|
| 183 |
processing_info.append("🖼️ Image analyzed")
|
| 184 |
except Exception as e:
|
| 185 |
content_parts.append({"type": "text", "text": f"Error analyzing image: {str(e)}"})
|
|
@@ -525,7 +525,7 @@ def create_interface():
|
|
| 525 |
)
|
| 526 |
text_input.submit(
|
| 527 |
process_text_input,
|
| 528 |
-
inputs=[api_key_input, text_input
|
| 529 |
outputs=[text_chatbot, text_input]
|
| 530 |
)
|
| 531 |
text_clear_btn.click(clear_chat, outputs=[text_chatbot, text_input])
|
|
@@ -612,8 +612,8 @@ if __name__ == "__main__":
|
|
| 612 |
"opencv-python",
|
| 613 |
"numpy",
|
| 614 |
"pydub",
|
| 615 |
-
"transformers",
|
| 616 |
-
"torch"
|
| 617 |
]
|
| 618 |
|
| 619 |
print("🚀 Multimodal Chatbot with Gemma 3n")
|
|
|
|
| 179 |
prompt = f"<image_soft_token> {text_input}" if text_input else "<image_soft_token> Describe this image"
|
| 180 |
output = self.pipe(image, text=prompt)
|
| 181 |
description = output[0]['generated_text']
|
| 182 |
+
content_parts.append({"type": "text", "text": f"Image TwitchImage analysis: {description}"})
|
| 183 |
processing_info.append("🖼️ Image analyzed")
|
| 184 |
except Exception as e:
|
| 185 |
content_parts.append({"type": "text", "text": f"Error analyzing image: {str(e)}"})
|
|
|
|
| 525 |
)
|
| 526 |
text_input.submit(
|
| 527 |
process_text_input,
|
| 528 |
+
inputs=[api_key_input, text_input, text_chatbot],
|
| 529 |
outputs=[text_chatbot, text_input]
|
| 530 |
)
|
| 531 |
text_clear_btn.click(clear_chat, outputs=[text_chatbot, text_input])
|
|
|
|
| 612 |
"opencv-python",
|
| 613 |
"numpy",
|
| 614 |
"pydub",
|
| 615 |
+
"transformers",
|
| 616 |
+
"torch"
|
| 617 |
]
|
| 618 |
|
| 619 |
print("🚀 Multimodal Chatbot with Gemma 3n")
|