bachvudinh commited on
Commit
8cfd1b6
1 Parent(s): 39cc970
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -15,11 +15,21 @@ from generate_audio import (
15
  )
16
  import uuid
17
 
18
- device = "cuda" if torch.cuda.is_available() else "cpu"
19
- vq_model = RQBottleneckTransformer.load_model(
20
- "whisper-vq-stoks-medium-en+pl-fixed.model"
21
- ).to(device)
22
- vq_model.ensure_whisper(device)
 
 
 
 
 
 
 
 
 
 
23
 
24
  @spaces.GPU
25
  def audio_to_sound_tokens_whisperspeech(audio_path):
 
15
  )
16
  import uuid
17
 
18
+
19
+ @spaces.GPU
20
+ def vq_model_load():
21
+ device = "cuda" if torch.cuda.is_available() else "cpu"
22
+ vq_model = RQBottleneckTransformer.load_model(
23
+ "whisper-vq-stoks-medium-en+pl-fixed.model"
24
+ ).to(device)
25
+ vq_model.ensure_whisper(device)
26
+ return vq_model
27
+ # device = "cuda" if torch.cuda.is_available() else "cpu"
28
+ # vq_model = RQBottleneckTransformer.load_model(
29
+ # "whisper-vq-stoks-medium-en+pl-fixed.model"
30
+ # ).to(device)
31
+ # vq_model.ensure_whisper(device)
32
+ vq_model = vq_model_load()
33
 
34
  @spaces.GPU
35
  def audio_to_sound_tokens_whisperspeech(audio_path):