Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from transformers import AutoProcessor, AutoModelForCausalLM, GenerationConfig,
|
|
3 |
from PIL import Image
|
4 |
import gradio as gr
|
5 |
from threading import Thread
|
|
|
6 |
|
7 |
# --- 1. Model and Processor Setup ---
|
8 |
# This part is loaded only once when the script starts.
|
@@ -45,7 +46,7 @@ except Exception as e:
|
|
45 |
exit()
|
46 |
|
47 |
# --- 2. Gradio Chatbot Logic with Streaming ---
|
48 |
-
|
49 |
def process_chat_streaming(user_message, chatbot_display, messages_list, image_pil):
|
50 |
"""
|
51 |
This generator function handles the chat logic with streaming.
|
@@ -173,4 +174,4 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue", secondary_hue="neutra
|
|
173 |
|
174 |
|
175 |
if __name__ == "__main__":
|
176 |
-
demo.
|
|
|
3 |
from PIL import Image
|
4 |
import gradio as gr
|
5 |
from threading import Thread
|
6 |
+
import spaces
|
7 |
|
8 |
# --- 1. Model and Processor Setup ---
|
9 |
# This part is loaded only once when the script starts.
|
|
|
46 |
exit()
|
47 |
|
48 |
# --- 2. Gradio Chatbot Logic with Streaming ---
|
49 |
+
@spaces.GPU
|
50 |
def process_chat_streaming(user_message, chatbot_display, messages_list, image_pil):
|
51 |
"""
|
52 |
This generator function handles the chat logic with streaming.
|
|
|
174 |
|
175 |
|
176 |
if __name__ == "__main__":
|
177 |
+
demo.launch(debug=True, mcp_server=True)
|