BoldActionMan commited on
Commit
fc96d57
1 Parent(s): c2b1b08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import os
3
  os.system("python -m unidic download")
 
4
  import torch
5
  from openvoice import se_extractor
6
  from openvoice.api import ToneColorConverter
@@ -19,9 +20,9 @@ def process_video(video_file, youtube_url, language_choice):
19
  if video_file != None and youtube_url != None:
20
  return None
21
  elif youtube_url != None:
22
- youtube_command = f"youtube-dl -o download_video.mp4 \"{youtube_url}\""
23
- os.system(youtube_command)
24
- video_file = "download_video.mp4"
25
 
26
  # Initialize paths and devices
27
  ckpt_converter = 'checkpoints_v2/converter'
 
1
  import gradio as gr
2
  import os
3
  os.system("python -m unidic download")
4
+ from pytube import YouTube
5
  import torch
6
  from openvoice import se_extractor
7
  from openvoice.api import ToneColorConverter
 
20
  if video_file != None and youtube_url != None:
21
  return None
22
  elif youtube_url != None:
23
+ yt = YouTube(youtube_url)
24
+ yt.streams.filter(progressive=True, file_extension='mp4').first().download(filename="original")
25
+ video_file = "original.mp4"
26
 
27
  # Initialize paths and devices
28
  ckpt_converter = 'checkpoints_v2/converter'