StevenChen16 commited on
Commit
307c54e
·
verified ·
1 Parent(s): ee53092

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -5,6 +5,7 @@ import tempfile
5
  import os
6
  import torch
7
  import gc
 
8
 
9
  # WhisperX配置
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -16,6 +17,7 @@ YT_LENGTH_LIMIT_S = 3600 # 1 hour YouTube files
16
  # 加载WhisperX模型
17
  model = whisperx.load_model(MODEL_NAME, device=device, compute_type=compute_type)
18
 
 
19
  def transcribe(inputs, task):
20
  if inputs is None:
21
  raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
 
5
  import os
6
  import torch
7
  import gc
8
+ import spaces
9
 
10
  # WhisperX配置
11
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
17
  # 加载WhisperX模型
18
  model = whisperx.load_model(MODEL_NAME, device=device, compute_type=compute_type)
19
 
20
+ @spaces.GPU
21
  def transcribe(inputs, task):
22
  if inputs is None:
23
  raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")