Mpavan45 commited on
Commit
68100f2
·
verified ·
1 Parent(s): 6dc4cef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -101,8 +101,12 @@ def extract_audio(file_path):
101
  return audio_path
102
 
103
  def transcribe_audio(audio_path):
104
- """Transcribes audio to text using Whisper."""
105
- model = whisper.load_model("base")
 
 
 
 
106
  result = model.transcribe(audio_path)
107
  return result['text']
108
 
 
101
  return audio_path
102
 
103
  def transcribe_audio(audio_path):
104
+ """Transcribes audio to text using Whisper with model download handling."""
105
+ try:
106
+ model = whisper.load_model("base")
107
+ except Exception:
108
+ st.warning("Downloading Whisper model. This may take a while...")
109
+ model = whisper.load_model("base")
110
  result = model.transcribe(audio_path)
111
  return result['text']
112