BoldActionMan
commited on
Commit
•
13bf54b
1
Parent(s):
0b978f8
Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,14 @@ from melo.api import TTS
|
|
13 |
from concurrent.futures import ThreadPoolExecutor
|
14 |
import ffmpeg
|
15 |
|
16 |
-
def process_video(video_file, language_choice):
|
17 |
if video_file == None or language_choice == None:
|
18 |
return None
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Initialize paths and devices
|
21 |
ckpt_converter = 'checkpoints_v2/converter'
|
@@ -258,10 +263,11 @@ language_choices.remove("auto")
|
|
258 |
gr.Interface(
|
259 |
fn=gradio_interface,
|
260 |
inputs=[
|
261 |
-
gr.Video(label="Upload
|
|
|
262 |
gr.Dropdown(choices=language_choices, label="Choose Language for Translation (Expressed in ISO 639-1 code)")
|
263 |
],
|
264 |
-
outputs=gr.Video(label="Translated Video"),
|
265 |
title="Video Translation and Voice Cloning",
|
266 |
description="Upload a video, choose a language to translate the audio, and download the processed video with translated audio."
|
267 |
).launch()
|
|
|
13 |
from concurrent.futures import ThreadPoolExecutor
|
14 |
import ffmpeg
|
15 |
|
16 |
+
def process_video(video_file, youtube_url, language_choice):
|
17 |
if video_file == None or language_choice == None:
|
18 |
return None
|
19 |
+
if video_file != None and youtube_url != None:
|
20 |
+
return None
|
21 |
+
else if youtube_url != None:
|
22 |
+
youtube_command = "youtube-dl " + youtube_url
|
23 |
+
os.system(youtube_command)
|
24 |
|
25 |
# Initialize paths and devices
|
26 |
ckpt_converter = 'checkpoints_v2/converter'
|
|
|
263 |
gr.Interface(
|
264 |
fn=gradio_interface,
|
265 |
inputs=[
|
266 |
+
gr.Video(label="Upload a video from your device storage", sources=['upload']),
|
267 |
+
gr.Textbox(label="OR enter a YouTube video URL"),
|
268 |
gr.Dropdown(choices=language_choices, label="Choose Language for Translation (Expressed in ISO 639-1 code)")
|
269 |
],
|
270 |
+
outputs=gr.Video(label="Translated Video", format='mp4'),
|
271 |
title="Video Translation and Voice Cloning",
|
272 |
description="Upload a video, choose a language to translate the audio, and download the processed video with translated audio."
|
273 |
).launch()
|