Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,14 @@
|
|
1 |
-
import
|
2 |
import whisperx
|
3 |
|
4 |
-
#
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
def transcribe(audio_path):
|
8 |
# 使用WhisperX进行转录
|
|
|
1 |
+
import torch
|
2 |
import whisperx
|
3 |
|
4 |
+
# 检测设备类型
|
5 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
6 |
+
|
7 |
+
# 设置计算类型
|
8 |
+
compute_type = "float16" if device == "cuda" else "int8"
|
9 |
+
|
10 |
+
# 加载 WhisperX 模型
|
11 |
+
model = whisperx.load_model("large-v3", device=device, compute_type=compute_type)
|
12 |
|
13 |
def transcribe(audio_path):
|
14 |
# 使用WhisperX进行转录
|