Update vc.py
Browse files
vc.py
CHANGED
@@ -29,8 +29,9 @@ def load_video_yt(vid):
|
|
29 |
return vid, vid_aud, f"{uid}-tmp_aud.mp4"
|
30 |
|
31 |
def trim_clip(clip, start_t, end_t):
|
32 |
-
clip = Path(f"{uid}-tmp_aud.mp4")
|
33 |
-
song = AudioSegment.from_file(f"{uid}-tmp_aud.mp4", format="mp4")
|
|
|
34 |
start_min = int(start_t.split(":",1)[0])
|
35 |
start_sec = int(start_t.split(":",1)[1])
|
36 |
end_min = int(end_t.split(":",1)[0])
|
@@ -45,7 +46,7 @@ def trim_clip(clip, start_t, end_t):
|
|
45 |
def pre_aud(inp):
|
46 |
song = AudioSegment.from_file(Path(f'{inp}', format="mp4"))
|
47 |
song.export(f"{uid}-tmp_aud.mp4", format="mp4")
|
48 |
-
|
49 |
with gr.Blocks() as app:
|
50 |
with gr.Box():
|
51 |
with gr.Row():
|
@@ -61,7 +62,7 @@ with gr.Blocks() as app:
|
|
61 |
|
62 |
in_aud_mic = gr.Audio(source='microphone')
|
63 |
in_aud_file = gr.Audio(label = 'Audio Source', source='upload', interactive = True)
|
64 |
-
aud_file = gr.File(interactive=False,visible=
|
65 |
with gr.Row():
|
66 |
start_time = gr.Textbox(label = "Start", value = "0:00", placeholder = "0:23")
|
67 |
end_time = gr.Textbox(label = "End", value = "0:01", placeholder = "1:12")
|
@@ -74,7 +75,7 @@ with gr.Blocks() as app:
|
|
74 |
|
75 |
|
76 |
|
77 |
-
in_aud_file.change(pre_aud,in_aud_file,
|
78 |
load_yt_btn.click(load_video_yt, in_aud_yt, [yt_vid,in_aud_file,aud_file])
|
79 |
trim_clip_btn.click(trim_clip,[aud_file, start_time, end_time],trim_aud)
|
80 |
alt_go_btn.click(custom_bark, [in_text,in_aud_file,trim_aud, in_aud_mic], out_audio)
|
|
|
29 |
return vid, vid_aud, f"{uid}-tmp_aud.mp4"
|
30 |
|
31 |
def trim_clip(clip, start_t, end_t):
|
32 |
+
#clip = Path(f"{uid}-tmp_aud.mp4")
|
33 |
+
#song = AudioSegment.from_file(f"{uid}-tmp_aud.mp4", format="mp4")
|
34 |
+
song = AudioSegment.from_file(Path(f"{clip}"), format="mp4")
|
35 |
start_min = int(start_t.split(":",1)[0])
|
36 |
start_sec = int(start_t.split(":",1)[1])
|
37 |
end_min = int(end_t.split(":",1)[0])
|
|
|
46 |
def pre_aud(inp):
|
47 |
song = AudioSegment.from_file(Path(f'{inp}', format="mp4"))
|
48 |
song.export(f"{uid}-tmp_aud.mp4", format="mp4")
|
49 |
+
return f"{uid}-tmp_aud.mp4"
|
50 |
with gr.Blocks() as app:
|
51 |
with gr.Box():
|
52 |
with gr.Row():
|
|
|
62 |
|
63 |
in_aud_mic = gr.Audio(source='microphone')
|
64 |
in_aud_file = gr.Audio(label = 'Audio Source', source='upload', interactive = True)
|
65 |
+
aud_file = gr.File(interactive=False,visible=True)
|
66 |
with gr.Row():
|
67 |
start_time = gr.Textbox(label = "Start", value = "0:00", placeholder = "0:23")
|
68 |
end_time = gr.Textbox(label = "End", value = "0:01", placeholder = "1:12")
|
|
|
75 |
|
76 |
|
77 |
|
78 |
+
in_aud_file.change(pre_aud,in_aud_file,aud_file)
|
79 |
load_yt_btn.click(load_video_yt, in_aud_yt, [yt_vid,in_aud_file,aud_file])
|
80 |
trim_clip_btn.click(trim_clip,[aud_file, start_time, end_time],trim_aud)
|
81 |
alt_go_btn.click(custom_bark, [in_text,in_aud_file,trim_aud, in_aud_mic], out_audio)
|