Spaces:
Running
Running
younes21000
commited on
Commit
•
6fa1fc7
1
Parent(s):
79df839
Update app.py
Browse files
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 (
|
20 |
-
"Small (
|
21 |
-
"Medium (
|
22 |
-
"Large (Slow,
|
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,
|
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
|
234 |
iface = gr.Interface(
|
235 |
fn=transcribe_video,
|
236 |
inputs=[
|
@@ -250,5 +250,5 @@ iface = gr.Interface(
|
|
250 |
live=False
|
251 |
)
|
252 |
|
253 |
-
|
254 |
-
|
|
|
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)
|