younes21000 commited on
Commit
6fa1fc7
1 Parent(s): 79df839

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -16,10 +16,10 @@ import shlex
16
  # Define available Whisper models
17
  whisper_models = {
18
  "Tiny (Fast, Less Accurate)": "tiny",
19
- "Base (Faster, Moderate Accuracy)": "base",
20
- "Small (Moderate Speed, Good Accuracy)": "small",
21
- "Medium (Slower, High Accuracy)": "medium",
22
- "Large (Slow, Very High Accuracy)": "large",
23
  }
24
 
25
  # Load M2M100 translation model for different languages
@@ -184,7 +184,7 @@ def write_ppt(transcription, output_file, tokenizer=None, translation_model=None
184
  ppt.save(output_file)
185
 
186
  # Transcribing video and generating output
187
- def transcribe_video(video_file, language, target_language, output_format, model_name):
188
  actual_model_name = whisper_models[model_name] # Map user selection to model name
189
  model = whisper.load_model(actual_model_name) # Load the selected model
190
 
@@ -230,7 +230,7 @@ def transcribe_video(video_file, language, target_language, output_format, model
230
  else:
231
  raise ValueError("Invalid output format selected.")
232
 
233
- # Gradio interface
234
  iface = gr.Interface(
235
  fn=transcribe_video,
236
  inputs=[
@@ -250,5 +250,5 @@ iface = gr.Interface(
250
  live=False
251
  )
252
 
253
- if __name__ == "__main__":
254
- iface.launch()
 
16
  # Define available Whisper models
17
  whisper_models = {
18
  "Tiny (Fast, Less Accurate)": "tiny",
19
+ "Base (Medium Speed, Medium Accuracy)": "base",
20
+ "Small (Good Speed, Good Accuracy)": "small",
21
+ "Medium (Slow, High Accuracy)": "medium",
22
+ "Large (Very Slow, Highest Accuracy)": "large"
23
  }
24
 
25
  # Load M2M100 translation model for different languages
 
184
  ppt.save(output_file)
185
 
186
  # Transcribing video and generating output
187
+ def transcribe_video(video_file, language, target_language, model_name, output_format):
188
  actual_model_name = whisper_models[model_name] # Map user selection to model name
189
  model = whisper.load_model(actual_model_name) # Load the selected model
190
 
 
230
  else:
231
  raise ValueError("Invalid output format selected.")
232
 
233
+ # Gradio Interface setup
234
  iface = gr.Interface(
235
  fn=transcribe_video,
236
  inputs=[
 
250
  live=False
251
  )
252
 
253
+ # Run the interface
254
+ iface.launch(share=True)