awacke1 commited on
Commit
1fdc8d9
1 Parent(s): 5740349

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -3,16 +3,13 @@ import gradio as gr
3
  import torch
4
  import uuid
5
  import os
6
-
7
  from pathlib import Path
8
  from pytube import YouTube
9
  from pydub import AudioSegment
10
  from TTS.api import TTS
11
 
12
  test_audio="./shufflin.wav"
13
-
14
  uid = uuid.uuid4()
15
-
16
  device = "cuda" if torch.cuda.is_available() else "cpu"
17
 
18
  def custom_bark(inp, in_aud=None, trim_aud=None, in_aud_mic=None):
@@ -37,7 +34,6 @@ def load_video_yt(vid):
37
  def trim_clip(clip, start_t, end_t):
38
  clip = Path(f"{clip}")
39
  song = AudioSegment.from_file(f"{clip}", format="mp4")
40
- #song = AudioSegment.from_file(Path(f"{clip}"), format="mp4")
41
  start_min = int(start_t.split(":",1)[0])
42
  start_sec = int(start_t.split(":",1)[1])
43
  end_min = int(end_t.split(":",1)[0])
@@ -57,16 +53,20 @@ def pre_aud(inp):
57
  return inp
58
 
59
  with gr.Blocks() as app:
 
60
  with gr.Group():
 
61
  with gr.Row():
62
  in_text = gr.Textbox(lines = 6, max_lines = 20)
63
  with gr.Column():
64
  alt_go_btn = gr.Button()
65
  out_audio = gr.Audio(interactive=False)
66
 
67
- with gr.Group():
 
68
  with gr.Row():
69
  gr.Markdown('''<H1> Audio Source:''')
 
70
  with gr.Row():
71
 
72
  with gr.Column():
@@ -78,12 +78,12 @@ with gr.Blocks() as app:
78
  end_time = gr.Textbox(label = "End", value = "0:01", placeholder = "1:12")
79
  trim_clip_btn = gr.Button("Trim Clip")
80
  trim_aud = gr.Audio(label = 'Trimmed Audio Source', sources=['upload'], interactive = False)
 
81
  with gr.Column():
82
  in_aud_yt = gr.Textbox(label="YouTube URL")
83
  load_yt_btn = gr.Button("Load URL")
84
  yt_vid = gr.Video(interactive=False)
85
 
86
- #in_aud_file.change(pre_aud,in_aud_file,aud_file)
87
  load_yt_btn.click(load_video_yt, in_aud_yt, [yt_vid,in_aud_file,aud_file])
88
  trim_clip_btn.click(trim_clip,[in_aud_file, start_time, end_time],trim_aud)
89
  alt_go_btn.click(custom_bark, [in_text,in_aud_file,trim_aud], out_audio)
 
3
  import torch
4
  import uuid
5
  import os
 
6
  from pathlib import Path
7
  from pytube import YouTube
8
  from pydub import AudioSegment
9
  from TTS.api import TTS
10
 
11
  test_audio="./shufflin.wav"
 
12
  uid = uuid.uuid4()
 
13
  device = "cuda" if torch.cuda.is_available() else "cpu"
14
 
15
  def custom_bark(inp, in_aud=None, trim_aud=None, in_aud_mic=None):
 
34
  def trim_clip(clip, start_t, end_t):
35
  clip = Path(f"{clip}")
36
  song = AudioSegment.from_file(f"{clip}", format="mp4")
 
37
  start_min = int(start_t.split(":",1)[0])
38
  start_sec = int(start_t.split(":",1)[1])
39
  end_min = int(end_t.split(":",1)[0])
 
53
  return inp
54
 
55
  with gr.Blocks() as app:
56
+
57
  with gr.Group():
58
+
59
  with gr.Row():
60
  in_text = gr.Textbox(lines = 6, max_lines = 20)
61
  with gr.Column():
62
  alt_go_btn = gr.Button()
63
  out_audio = gr.Audio(interactive=False)
64
 
65
+ with gr.Group():
66
+
67
  with gr.Row():
68
  gr.Markdown('''<H1> Audio Source:''')
69
+
70
  with gr.Row():
71
 
72
  with gr.Column():
 
78
  end_time = gr.Textbox(label = "End", value = "0:01", placeholder = "1:12")
79
  trim_clip_btn = gr.Button("Trim Clip")
80
  trim_aud = gr.Audio(label = 'Trimmed Audio Source', sources=['upload'], interactive = False)
81
+
82
  with gr.Column():
83
  in_aud_yt = gr.Textbox(label="YouTube URL")
84
  load_yt_btn = gr.Button("Load URL")
85
  yt_vid = gr.Video(interactive=False)
86
 
 
87
  load_yt_btn.click(load_video_yt, in_aud_yt, [yt_vid,in_aud_file,aud_file])
88
  trim_clip_btn.click(trim_clip,[in_aud_file, start_time, end_time],trim_aud)
89
  alt_go_btn.click(custom_bark, [in_text,in_aud_file,trim_aud], out_audio)