yasserrmd commited on
Commit
d0d0cf3
1 Parent(s): 45853c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -3,15 +3,16 @@ from transformers import pipeline
3
  import spaces
4
 
5
  # Load the Whisper model from Hugging Face
6
- model = pipeline("automatic-speech-recognition", model="ylacombe/whisper-large-v3-turbo")
7
 
8
  # Function to process audio input and transcribe it
9
  @spaces.GPU
10
  def transcribe(audio):
11
  # Load and preprocess the audio
12
- transcription = model(audio)["text"]
13
  return transcription
14
 
 
15
  # Gradio interface
16
  interface = gr.Interface(
17
  fn=transcribe,
 
3
  import spaces
4
 
5
  # Load the Whisper model from Hugging Face
6
+ model = pipeline("automatic-speech-recognition", model="ylacombe/whisper-large-v3-turbo", chunk_length_s=30, device=0)
7
 
8
  # Function to process audio input and transcribe it
9
  @spaces.GPU
10
  def transcribe(audio):
11
  # Load and preprocess the audio
12
+ transcription = model(audio,batch_size=1000, generate_kwargs={"task": "transcribe"}, return_timestamps=True)["text"]
13
  return transcription
14
 
15
+
16
  # Gradio interface
17
  interface = gr.Interface(
18
  fn=transcribe,