quan3054 commited on
Commit
f7c993e
·
1 Parent(s): fbc4fbc

fix bug timeline of voice longer than 30s

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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