EC2 Default User
commited on
Commit
·
644c521
1
Parent(s):
bc936ee
Removing random filename output
Browse files
app.py
CHANGED
|
@@ -48,7 +48,7 @@ def download_video(url):
|
|
| 48 |
)
|
| 49 |
print("Downloaded")
|
| 50 |
return local_file
|
| 51 |
-
|
| 52 |
|
| 53 |
|
| 54 |
def download_youtube(url):
|
|
@@ -130,10 +130,6 @@ def youtube_trim(url,start,end):
|
|
| 130 |
trimmed_audio= parent_dir+'/sample_data/input_audio.mp3'
|
| 131 |
#delete trimmed if already exits
|
| 132 |
clean_data()
|
| 133 |
-
#call(["rm","-f",trimmed_audio])
|
| 134 |
-
#call(["rm","-f",trimmed_video])
|
| 135 |
-
|
| 136 |
-
#!rm -f {trimmed_video}
|
| 137 |
# cut the video
|
| 138 |
call(["ffmpeg","-y","-i",input_videos,"-ss", start,"-t",interval,"-async","1",trimmed_video])
|
| 139 |
#!ffmpeg -y -i youtube.mp4 -ss {start} -t {interval} -async 1 {trimmed_video}
|
|
@@ -158,7 +154,7 @@ def create_video(Text,Voicetoclone):
|
|
| 158 |
rescaleFactor = 1#@param {type:"integer"}
|
| 159 |
nosmooth = False #@param {type:"boolean"}
|
| 160 |
|
| 161 |
-
out_name ="
|
| 162 |
out_file="../"+out_name
|
| 163 |
|
| 164 |
if nosmooth == False:
|
|
@@ -270,7 +266,7 @@ text_to_say=gr.inputs.Textbox(label='What would you like the voice to say? (max.
|
|
| 270 |
url =gr.inputs.Textbox(label = "Enter the YouTube URL below:")
|
| 271 |
initial_time = gr.inputs.Textbox(label='Initial time of trim? (format: hh:mm:ss)')
|
| 272 |
final_time= gr.inputs.Textbox(label='Final time to trim? (format: hh:mm:ss)')
|
| 273 |
-
|
| 274 |
inputs = [text_to_say,url,initial_time,final_time],
|
| 275 |
outputs = 'video',
|
| 276 |
verbose = True,
|
|
@@ -288,7 +284,7 @@ demo = gr.Interface(fn = video_generator,
|
|
| 288 |
For more information visit <a href="https://ruslanmv.com/">ruslanmv.com</a>
|
| 289 |
</p>
|
| 290 |
</div>''',
|
| 291 |
-
|
| 292 |
examples = [['I am clonning your voice. Charles!. Machine intelligence is the last invention that humanity will ever need to make.',
|
| 293 |
"https://www.youtube.com/watch?v=xw5dvItD5zY",
|
| 294 |
"00:00:01","00:00:10"],
|
|
@@ -310,6 +306,7 @@ demo = gr.Interface(fn = video_generator,
|
|
| 310 |
['I am clonning your voice. Alexandria!. Machine intelligence is the last invention that humanity will ever need to make.',
|
| 311 |
"https://www.youtube.com/watch?v=Eht6oIkzkew",
|
| 312 |
"00:00:02", "00:00:30"],
|
| 313 |
-
]
|
| 314 |
-
|
| 315 |
-
|
|
|
|
|
|
| 48 |
)
|
| 49 |
print("Downloaded")
|
| 50 |
return local_file
|
| 51 |
+
|
| 52 |
|
| 53 |
|
| 54 |
def download_youtube(url):
|
|
|
|
| 130 |
trimmed_audio= parent_dir+'/sample_data/input_audio.mp3'
|
| 131 |
#delete trimmed if already exits
|
| 132 |
clean_data()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
# cut the video
|
| 134 |
call(["ffmpeg","-y","-i",input_videos,"-ss", start,"-t",interval,"-async","1",trimmed_video])
|
| 135 |
#!ffmpeg -y -i youtube.mp4 -ss {start} -t {interval} -async 1 {trimmed_video}
|
|
|
|
| 154 |
rescaleFactor = 1#@param {type:"integer"}
|
| 155 |
nosmooth = False #@param {type:"boolean"}
|
| 156 |
|
| 157 |
+
out_name ="result_voice.mp4"
|
| 158 |
out_file="../"+out_name
|
| 159 |
|
| 160 |
if nosmooth == False:
|
|
|
|
| 266 |
url =gr.inputs.Textbox(label = "Enter the YouTube URL below:")
|
| 267 |
initial_time = gr.inputs.Textbox(label='Initial time of trim? (format: hh:mm:ss)')
|
| 268 |
final_time= gr.inputs.Textbox(label='Final time to trim? (format: hh:mm:ss)')
|
| 269 |
+
gr.Interface(fn = video_generator,
|
| 270 |
inputs = [text_to_say,url,initial_time,final_time],
|
| 271 |
outputs = 'video',
|
| 272 |
verbose = True,
|
|
|
|
| 284 |
For more information visit <a href="https://ruslanmv.com/">ruslanmv.com</a>
|
| 285 |
</p>
|
| 286 |
</div>''',
|
| 287 |
+
enable_queue=True,
|
| 288 |
examples = [['I am clonning your voice. Charles!. Machine intelligence is the last invention that humanity will ever need to make.',
|
| 289 |
"https://www.youtube.com/watch?v=xw5dvItD5zY",
|
| 290 |
"00:00:01","00:00:10"],
|
|
|
|
| 306 |
['I am clonning your voice. Alexandria!. Machine intelligence is the last invention that humanity will ever need to make.',
|
| 307 |
"https://www.youtube.com/watch?v=Eht6oIkzkew",
|
| 308 |
"00:00:02", "00:00:30"],
|
| 309 |
+
],
|
| 310 |
+
allow_flagging=False
|
| 311 |
+
).launch()
|
| 312 |
+
|