Spaces:
Runtime error
Runtime error
Commit
·
bfa484b
1
Parent(s):
da0daa9
commit
Browse files- app.py +5 -13
- requirements.txt +2 -2
app.py
CHANGED
@@ -9,6 +9,8 @@ from whisper.utils import write_vtt
|
|
9 |
|
10 |
model = whisper.load_model("medium")
|
11 |
|
|
|
|
|
12 |
def video2mp3(video_file, output_ext="mp3"):
|
13 |
filename, ext = os.path.splitext(video_file)
|
14 |
subprocess.call(["ffmpeg", "-y", "-i", video_file, f"{filename}.{output_ext}"],
|
@@ -25,7 +27,7 @@ def translate(input_video):
|
|
25 |
translate_options = dict(task="translate", **options)
|
26 |
result = model.transcribe(audio_file,**translate_options)
|
27 |
|
28 |
-
output_dir = '
|
29 |
audio_path = audio_file.split(".")[0]
|
30 |
|
31 |
with open(os.path.join(output_dir, audio_path + ".vtt"), "w") as vtt:
|
@@ -38,21 +40,12 @@ def translate(input_video):
|
|
38 |
|
39 |
return output_video
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
title = "Add Caption to your Videos - MultiLingual"
|
44 |
-
|
45 |
block = gr.Blocks()
|
46 |
-
|
47 |
with block:
|
48 |
|
49 |
with gr.Group():
|
50 |
-
with gr.Box():
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
with gr.Row().style():
|
55 |
-
|
56 |
inp_video = gr.Video(
|
57 |
label="Input Video",
|
58 |
type="filepath",
|
@@ -67,7 +60,6 @@ with block:
|
|
67 |
|
68 |
|
69 |
btn.click(translate, inputs=[inp_video], outputs=[op_video])
|
70 |
-
|
71 |
gr.HTML('''
|
72 |
<div class="footer">
|
73 |
<p>Powered by <a href="https://openai.com/" style="text-decoration: underline;" target="_blank">OpenAI</a> - Developed by <a href="https://github.com/Isaakkamau" style="text-decoration: underline;" target="_blank">+254704205553</a>
|
@@ -75,4 +67,4 @@ with block:
|
|
75 |
</div>
|
76 |
''')
|
77 |
|
78 |
-
block.launch(
|
|
|
9 |
|
10 |
model = whisper.load_model("medium")
|
11 |
|
12 |
+
title = "Add Text/Caption to your YouTube Shorts - MultiLingual"
|
13 |
+
|
14 |
def video2mp3(video_file, output_ext="mp3"):
|
15 |
filename, ext = os.path.splitext(video_file)
|
16 |
subprocess.call(["ffmpeg", "-y", "-i", video_file, f"{filename}.{output_ext}"],
|
|
|
27 |
translate_options = dict(task="translate", **options)
|
28 |
result = model.transcribe(audio_file,**translate_options)
|
29 |
|
30 |
+
output_dir = ''
|
31 |
audio_path = audio_file.split(".")[0]
|
32 |
|
33 |
with open(os.path.join(output_dir, audio_path + ".vtt"), "w") as vtt:
|
|
|
40 |
|
41 |
return output_video
|
42 |
|
|
|
|
|
|
|
|
|
43 |
block = gr.Blocks()
|
|
|
44 |
with block:
|
45 |
|
46 |
with gr.Group():
|
47 |
+
with gr.Box():
|
|
|
|
|
|
|
48 |
with gr.Row().style():
|
|
|
49 |
inp_video = gr.Video(
|
50 |
label="Input Video",
|
51 |
type="filepath",
|
|
|
60 |
|
61 |
|
62 |
btn.click(translate, inputs=[inp_video], outputs=[op_video])
|
|
|
63 |
gr.HTML('''
|
64 |
<div class="footer">
|
65 |
<p>Powered by <a href="https://openai.com/" style="text-decoration: underline;" target="_blank">OpenAI</a> - Developed by <a href="https://github.com/Isaakkamau" style="text-decoration: underline;" target="_blank">+254704205553</a>
|
|
|
67 |
</div>
|
68 |
''')
|
69 |
|
70 |
+
block.launch(enable_queue = True)
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
|
2 |
-
|
3 |
gTTS==2.2.2
|
4 |
googletrans==3.1.0a0
|
5 |
openai-whisper==20230117
|
|
|
1 |
+
tensorflow
|
2 |
+
openai-whisper==20230117
|
3 |
gTTS==2.2.2
|
4 |
googletrans==3.1.0a0
|
5 |
openai-whisper==20230117
|