prasanacodes commited on
Commit
afada3a
·
verified ·
1 Parent(s): 15be79b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -19,14 +19,6 @@ torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
19
 
20
  print(f"Using device: {device}")
21
 
22
- # Initialize the ASR pipeline from Hugging Face Transformers
23
- transcriber = pipeline(
24
- "automatic-speech-recognition",
25
- model="openai/whisper-large-v3-turbo",
26
- torch_dtype=torch_dtype,
27
- device=device,
28
- )
29
-
30
  # --- Transcription Function ---
31
  def extract_audio_from_video(video_path, output_audio_path="temp_extracted_audio.wav"):
32
  """
@@ -60,6 +52,16 @@ def transcribe_audio(audio_path):
60
  This function takes an audio file path, transcribes it using the Whisper model,
61
  and returns the transcribed text.
62
  """
 
 
 
 
 
 
 
 
 
 
63
  if audio_path is None:
64
  return "No audio file provided. Please upload or record an audio file."
65
 
 
19
 
20
  print(f"Using device: {device}")
21
 
 
 
 
 
 
 
 
 
22
  # --- Transcription Function ---
23
  def extract_audio_from_video(video_path, output_audio_path="temp_extracted_audio.wav"):
24
  """
 
52
  This function takes an audio file path, transcribes it using the Whisper model,
53
  and returns the transcribed text.
54
  """
55
+ # Initialize the ASR pipeline from Hugging Face Transformers
56
+
57
+ transcriber = pipeline(
58
+ "automatic-speech-recognition",
59
+ model="openai/whisper-large-v3-turbo",
60
+ torch_dtype=torch_dtype,
61
+ device=device,
62
+ language='en',
63
+ )
64
+
65
  if audio_path is None:
66
  return "No audio file provided. Please upload or record an audio file."
67