Spaces:
Sleeping
Sleeping
fix bug timeline of voice longer than 30s
Browse files
app.py
CHANGED
@@ -5,10 +5,10 @@ from transformers import pipeline
|
|
5 |
# Cấu hình mô hình
|
6 |
model_id = "kotoba-tech/kotoba-whisper-bilingual-v1.0"
|
7 |
device = 0 if torch.cuda.is_available() else -1
|
8 |
-
pipe = pipeline("automatic-speech-recognition", model=model_id, device=device)
|
9 |
|
10 |
def transcribe(audio):
|
11 |
-
result = pipe(audio)["text"]
|
12 |
return result
|
13 |
|
14 |
# Giao diện Gradio
|
|
|
5 |
# Cấu hình mô hình
|
6 |
model_id = "kotoba-tech/kotoba-whisper-bilingual-v1.0"
|
7 |
device = 0 if torch.cuda.is_available() else -1
|
8 |
+
pipe = pipeline("automatic-speech-recognition", model=model_id, device=device, chunk_length_s=30)
|
9 |
|
10 |
def transcribe(audio):
|
11 |
+
result = pipe(audio, return_timestamps=True)["text"]
|
12 |
return result
|
13 |
|
14 |
# Giao diện Gradio
|