Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
from utils import language_dict
|
| 3 |
import math
|
| 4 |
import torch
|
|
@@ -130,6 +130,8 @@ def format_segments(segments):
|
|
| 130 |
return sentence_timestamp, words_timestamp, speech_to_text
|
| 131 |
|
| 132 |
def combine_word_segments(words_timestamp, max_words_per_subtitle=8, min_silence_between_words=0.5):
|
|
|
|
|
|
|
| 133 |
before_translate = {}
|
| 134 |
id = 1
|
| 135 |
text = ""
|
|
@@ -322,7 +324,6 @@ def main(debug, share):
|
|
| 322 |
demo = gr.Interface(fn=subtitle_maker, inputs=gradio_inputs, outputs=gradio_outputs, title="Whisper-Large-V3-Turbo-Ct2 Subtitle Maker")
|
| 323 |
|
| 324 |
# Launch Gradio with command-line options
|
| 325 |
-
demo.launch(debug=debug, share=share)
|
| 326 |
-
|
| 327 |
if __name__ == "__main__":
|
| 328 |
main()
|
|
|
|
| 1 |
+
#@title Utils
|
| 2 |
from utils import language_dict
|
| 3 |
import math
|
| 4 |
import torch
|
|
|
|
| 130 |
return sentence_timestamp, words_timestamp, speech_to_text
|
| 131 |
|
| 132 |
def combine_word_segments(words_timestamp, max_words_per_subtitle=8, min_silence_between_words=0.5):
|
| 133 |
+
if max_words_per_subtitle<=1:
|
| 134 |
+
max_words_per_subtitle=1
|
| 135 |
before_translate = {}
|
| 136 |
id = 1
|
| 137 |
text = ""
|
|
|
|
| 324 |
demo = gr.Interface(fn=subtitle_maker, inputs=gradio_inputs, outputs=gradio_outputs, title="Whisper-Large-V3-Turbo-Ct2 Subtitle Maker")
|
| 325 |
|
| 326 |
# Launch Gradio with command-line options
|
| 327 |
+
demo.queue().launch(debug=debug, share=share)
|
|
|
|
| 328 |
if __name__ == "__main__":
|
| 329 |
main()
|