Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import Qwen2_5OmniModel, AutoProcessor
|
3 |
-
from qwen_omni_utils import process_mm_info
|
4 |
import torch
|
5 |
|
6 |
# Load model and processor
|
@@ -22,13 +21,13 @@ def process_input(text_input, image_input=None, audio_input=None, video_input=No
|
|
22 |
conversation[0]["content"].append({"video": video_input})
|
23 |
|
24 |
# Process conversation
|
25 |
-
model_inputs = processor.
|
26 |
|
27 |
# Generate response
|
28 |
outputs = model.generate(**model_inputs, max_length=200)
|
29 |
response_text = processor.decode(outputs[0], skip_special_tokens=True)
|
30 |
|
31 |
-
# Audio output
|
32 |
response_audio = None
|
33 |
|
34 |
return response_text, response_audio
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import Qwen2_5OmniModel, AutoProcessor
|
|
|
3 |
import torch
|
4 |
|
5 |
# Load model and processor
|
|
|
21 |
conversation[0]["content"].append({"video": video_input})
|
22 |
|
23 |
# Process conversation
|
24 |
+
model_inputs = processor.apply_chat_template(conversation, return_tensors="pt").to(device)
|
25 |
|
26 |
# Generate response
|
27 |
outputs = model.generate(**model_inputs, max_length=200)
|
28 |
response_text = processor.decode(outputs[0], skip_special_tokens=True)
|
29 |
|
30 |
+
# Audio output not implemented
|
31 |
response_audio = None
|
32 |
|
33 |
return response_text, response_audio
|