Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,9 @@ import torch
|
|
3 |
from transformers import AutoProcessor, BarkModel
|
4 |
import scipy
|
5 |
from pytube import YouTube
|
6 |
-
import
|
|
|
|
|
7 |
|
8 |
|
9 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
@@ -43,12 +45,17 @@ def load_video_yt(vid):
|
|
43 |
return vid, vid_aud
|
44 |
|
45 |
def trim_clip(clip):
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
with gr.Blocks() as app:
|
54 |
with gr.Column():
|
@@ -69,6 +76,7 @@ with gr.Blocks() as app:
|
|
69 |
trim_clip_btn = gr.Button("Trim Clip")
|
70 |
trim_aud = gr.Audio(source='upload')
|
71 |
yt_vid = gr.Video()
|
|
|
72 |
alt_go_btn = gr.Button()
|
73 |
#speaker_num = gr.Number(value=0)
|
74 |
|
@@ -77,7 +85,7 @@ with gr.Blocks() as app:
|
|
77 |
|
78 |
go_btn.click(run_bark,[in_text, speaker_num, speaker_lang],out_audio)
|
79 |
load_yt_btn.click(load_video_yt, in_aud_yt, [yt_vid,in_aud_file])
|
80 |
-
trim_clip_btn.click(trim_clip,
|
81 |
#alt_go_btn.click()
|
82 |
|
83 |
app.launch()
|
|
|
3 |
from transformers import AutoProcessor, BarkModel
|
4 |
import scipy
|
5 |
from pytube import YouTube
|
6 |
+
from moviepy.editor import *
|
7 |
+
|
8 |
+
#import ffmpeg
|
9 |
|
10 |
|
11 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
45 |
return vid, vid_aud
|
46 |
|
47 |
def trim_clip(clip):
|
48 |
+
|
49 |
+
# loading video dsa gfg intro video
|
50 |
+
clip = VideoFileClip(clip)
|
51 |
+
|
52 |
+
# getting only first 5 seconds
|
53 |
+
clip = clip.subclip(0, 15)
|
54 |
+
|
55 |
+
# cutting out some part from the clip
|
56 |
+
clip = clip.cutout(3, 10)
|
57 |
+
|
58 |
+
return clip
|
59 |
|
60 |
with gr.Blocks() as app:
|
61 |
with gr.Column():
|
|
|
76 |
trim_clip_btn = gr.Button("Trim Clip")
|
77 |
trim_aud = gr.Audio(source='upload')
|
78 |
yt_vid = gr.Video()
|
79 |
+
trim_vid=gr.Video()
|
80 |
alt_go_btn = gr.Button()
|
81 |
#speaker_num = gr.Number(value=0)
|
82 |
|
|
|
85 |
|
86 |
go_btn.click(run_bark,[in_text, speaker_num, speaker_lang],out_audio)
|
87 |
load_yt_btn.click(load_video_yt, in_aud_yt, [yt_vid,in_aud_file])
|
88 |
+
trim_clip_btn.click(trim_clip,yt_vid,trim_vid)
|
89 |
#alt_go_btn.click()
|
90 |
|
91 |
app.launch()
|