aimeri commited on
Commit
c7db60b
·
1 Parent(s): 039d869

Refactor app.py to import 'spaces' and add GPU decorator; update requirements.txt to remove no-build-isolation flag from flash-attn

Browse files
Files changed (2) hide show
  1. app.py +2 -3
  2. requirements.txt +1 -1
app.py CHANGED
@@ -3,10 +3,8 @@ import torch
3
  from transformers import Qwen2_5OmniModel, Qwen2_5OmniProcessor
4
  from qwen_omni_utils import process_mm_info
5
  import soundfile as sf
6
- import os
7
- from datetime import datetime
8
  import tempfile
9
- import base64
10
 
11
  # Initialize the model and processor
12
  device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -34,6 +32,7 @@ VOICE_OPTIONS = {
34
  "Ethan (Male)": "Ethan"
35
  }
36
 
 
37
  def process_input(user_input, chat_history, voice_type, enable_audio_output):
38
  # Prepare conversation history
39
  conversation = [SYSTEM_PROMPT]
 
3
  from transformers import Qwen2_5OmniModel, Qwen2_5OmniProcessor
4
  from qwen_omni_utils import process_mm_info
5
  import soundfile as sf
 
 
6
  import tempfile
7
+ import spaces
8
 
9
  # Initialize the model and processor
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
32
  "Ethan (Male)": "Ethan"
33
  }
34
 
35
+ @spaces.GPU
36
  def process_input(user_input, chat_history, voice_type, enable_audio_output):
37
  # Prepare conversation history
38
  conversation = [SYSTEM_PROMPT]
requirements.txt CHANGED
@@ -3,4 +3,4 @@ qwen-omni-utils[decord]
3
  soundfile
4
  torch
5
  gradio
6
- flash-attn --no-build-isolation
 
3
  soundfile
4
  torch
5
  gradio
6
+ flash-attn