Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,6 @@ MODELS_TO_DOWNLOAD = ['tiny', 'medium'] # ['tiny', 'small', 'base', 'medium', 'l
|
|
| 7 |
for model_name in MODELS_TO_DOWNLOAD:
|
| 8 |
os.system(f'bash ./whisper.cpp/models/download-ggml-model.sh {model_name}')
|
| 9 |
|
| 10 |
-
|
| 11 |
### BODY ###
|
| 12 |
|
| 13 |
import os
|
|
@@ -25,6 +24,10 @@ import time
|
|
| 25 |
from pytube import YouTube
|
| 26 |
import torch
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
whisper_models = MODELS_TO_DOWNLOAD #["medium"]#["base", "small", "medium", "large", "base.en"]
|
| 29 |
|
| 30 |
custom_models = []
|
|
@@ -138,7 +141,7 @@ subtitle_files = gr.File(
|
|
| 138 |
interactive=False,
|
| 139 |
)
|
| 140 |
|
| 141 |
-
video_player = gr.HTML('<p>video will be played here
|
| 142 |
eventslider = gr.Slider(visible=False)
|
| 143 |
status_msg = gr.Markdown('Status')
|
| 144 |
|
|
@@ -171,7 +174,8 @@ with demo:
|
|
| 171 |
|
| 172 |
with gr.Row():
|
| 173 |
with gr.Column():
|
| 174 |
-
gr.Markdown(
|
|
|
|
| 175 |
examples = gr.Examples(examples=["https://www.youtube.com/watch?v=UjAn3Pza3qo", "https://www.youtube.com/watch?v=oOZivhYfPD4"],
|
| 176 |
label="Examples", inputs=[youtube_url_in])
|
| 177 |
# Inspiration from https://huggingface.co/spaces/vumichien/whisper-speaker-diarization
|
|
@@ -195,7 +199,6 @@ with demo:
|
|
| 195 |
dep = demo.load(on_change_event, inputs=[app_state], outputs=[status_msg], every=10)
|
| 196 |
|
| 197 |
|
| 198 |
-
|
| 199 |
#### RUN ###
|
| 200 |
is_kaggle = os.environ.get('KAGGLE_KERNEL_RUN_TYPE')
|
| 201 |
print(is_kaggle)
|
|
|
|
| 7 |
for model_name in MODELS_TO_DOWNLOAD:
|
| 8 |
os.system(f'bash ./whisper.cpp/models/download-ggml-model.sh {model_name}')
|
| 9 |
|
|
|
|
| 10 |
### BODY ###
|
| 11 |
|
| 12 |
import os
|
|
|
|
| 24 |
from pytube import YouTube
|
| 25 |
import torch
|
| 26 |
|
| 27 |
+
INTRO_MSG = '#### There are many not very widely spoken languages for which it is quite hard to find learning materials, especially well dubbed videos. \
|
| 28 |
+
This tool will hopefully generate subtitles so you can watch the video of your target language with corresponding subs. At least for me this is nice tool \
|
| 29 |
+
to practice both listening and reading skills'
|
| 30 |
+
|
| 31 |
whisper_models = MODELS_TO_DOWNLOAD #["medium"]#["base", "small", "medium", "large", "base.en"]
|
| 32 |
|
| 33 |
custom_models = []
|
|
|
|
| 141 |
interactive=False,
|
| 142 |
)
|
| 143 |
|
| 144 |
+
video_player = gr.HTML('<p>video will be played here')
|
| 145 |
eventslider = gr.Slider(visible=False)
|
| 146 |
status_msg = gr.Markdown('Status')
|
| 147 |
|
|
|
|
| 174 |
|
| 175 |
with gr.Row():
|
| 176 |
with gr.Column():
|
| 177 |
+
gr.Markdown(INTRO_MSG)
|
| 178 |
+
gr.Markdown('''### Copy any non-private Youtube video URL to box below or click one of the examples.''')
|
| 179 |
examples = gr.Examples(examples=["https://www.youtube.com/watch?v=UjAn3Pza3qo", "https://www.youtube.com/watch?v=oOZivhYfPD4"],
|
| 180 |
label="Examples", inputs=[youtube_url_in])
|
| 181 |
# Inspiration from https://huggingface.co/spaces/vumichien/whisper-speaker-diarization
|
|
|
|
| 199 |
dep = demo.load(on_change_event, inputs=[app_state], outputs=[status_msg], every=10)
|
| 200 |
|
| 201 |
|
|
|
|
| 202 |
#### RUN ###
|
| 203 |
is_kaggle = os.environ.get('KAGGLE_KERNEL_RUN_TYPE')
|
| 204 |
print(is_kaggle)
|