Spaces:
Runtime error
Runtime error
Commit
·
7fc5b77
1
Parent(s):
7128a95
feat:added chunk length
Browse files
app.py
CHANGED
@@ -1,9 +1,17 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from transformers import pipeline
|
3 |
import numpy as np
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
def transcribe(audio):
|
9 |
sr, y = audio
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
from transformers import pipeline
|
4 |
import numpy as np
|
5 |
|
6 |
+
MODEL_NAME = "biodatlab/whisper-th-medium-combined"
|
7 |
+
DEVICE = 0 if torch.cuda.is_available() else "cpu"
|
8 |
+
|
9 |
+
transcriber = pipeline(
|
10 |
+
"automatic-speech-recognition",
|
11 |
+
model=MODEL_NAME,
|
12 |
+
chunk_length_s=30,
|
13 |
+
device=DEVICE
|
14 |
+
)
|
15 |
|
16 |
def transcribe(audio):
|
17 |
sr, y = audio
|