Spaces:
Runtime error
Runtime error
Next
commited on
Commit
•
8991da7
1
Parent(s):
5badce9
Update app.py
Browse files
app.py
CHANGED
@@ -2,11 +2,302 @@ import os
|
|
2 |
from scipy.io.wavfile import write
|
3 |
import gradio as gr
|
4 |
import yt_dlp
|
5 |
-
import spaces
|
6 |
|
7 |
os.makedirs("ytdl", exist_ok=True)
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
def separator(audio):
|
11 |
os.makedirs("output", exist_ok=True)
|
12 |
write('test.wav', audio[0], audio[1])
|
@@ -45,8 +336,9 @@ def download_and_show(url):
|
|
45 |
file_path = download_audio(url)
|
46 |
return file_path
|
47 |
|
48 |
-
with gr.Blocks() as demo:
|
49 |
-
|
|
|
50 |
audio_input = gr.Audio(type="numpy", label="Input")
|
51 |
output1 = gr.Audio(type="filepath", label="Stem 1", interactive=False)
|
52 |
output2 = gr.Audio(type="filepath", label="Stem 2", interactive=False)
|
@@ -56,7 +348,7 @@ with gr.Blocks() as demo:
|
|
56 |
inputs=[audio_input],
|
57 |
outputs=[output1, output2]
|
58 |
)
|
59 |
-
|
60 |
url = gr.Textbox(label="URL to YouTube")
|
61 |
download = gr.Button("Download")
|
62 |
download.click(
|
|
|
2 |
from scipy.io.wavfile import write
|
3 |
import gradio as gr
|
4 |
import yt_dlp
|
|
|
5 |
|
6 |
os.makedirs("ytdl", exist_ok=True)
|
7 |
|
8 |
+
|
9 |
+
|
10 |
+
# applio theme imports
|
11 |
+
from gradio.themes.Soft import Base
|
12 |
+
from gradio.themes.utils import colors, fonts, sizes
|
13 |
+
from typing import Iterable
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
# Applio Theme
|
19 |
+
class Applio(Base):
|
20 |
+
def __init__(
|
21 |
+
self,
|
22 |
+
*,
|
23 |
+
primary_hue: colors.Color | str = colors.neutral,
|
24 |
+
secondary_hue: colors.Color | str = colors.neutral,
|
25 |
+
neutral_hue: colors.Color | str = colors.neutral,
|
26 |
+
spacing_size: sizes.Size | str = sizes.spacing_md,
|
27 |
+
radius_size: sizes.Size | str = sizes.radius_md,
|
28 |
+
text_size: sizes.Size | str = sizes.text_lg,
|
29 |
+
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
30 |
+
"Syne V",
|
31 |
+
fonts.GoogleFont("Syne"),
|
32 |
+
"ui-sans-serif",
|
33 |
+
"system-ui",
|
34 |
+
),
|
35 |
+
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
|
36 |
+
"ui-monospace",
|
37 |
+
fonts.GoogleFont("Nunito Sans"),
|
38 |
+
),
|
39 |
+
):
|
40 |
+
super().__init__(
|
41 |
+
primary_hue=primary_hue,
|
42 |
+
secondary_hue=secondary_hue,
|
43 |
+
neutral_hue=neutral_hue,
|
44 |
+
spacing_size=spacing_size,
|
45 |
+
radius_size=radius_size,
|
46 |
+
text_size=text_size,
|
47 |
+
font=font,
|
48 |
+
font_mono=font_mono,
|
49 |
+
)
|
50 |
+
self.name = ("Applio",)
|
51 |
+
self.secondary_100 = ("#dbeafe",)
|
52 |
+
self.secondary_200 = ("#bfdbfe",)
|
53 |
+
self.secondary_300 = ("#93c5fd",)
|
54 |
+
self.secondary_400 = ("#60a5fa",)
|
55 |
+
self.secondary_50 = ("#eff6ff",)
|
56 |
+
self.secondary_500 = ("#3b82f6",)
|
57 |
+
self.secondary_600 = ("#2563eb",)
|
58 |
+
self.secondary_700 = ("#1d4ed8",)
|
59 |
+
self.secondary_800 = ("#1e40af",)
|
60 |
+
self.secondary_900 = ("#1e3a8a",)
|
61 |
+
self.secondary_950 = ("#1d3660",)
|
62 |
+
|
63 |
+
super().set(
|
64 |
+
# Blaise
|
65 |
+
background_fill_primary="#110F0F",
|
66 |
+
background_fill_primary_dark="#110F0F",
|
67 |
+
background_fill_secondary="#110F0F",
|
68 |
+
background_fill_secondary_dark="#110F0F",
|
69 |
+
block_background_fill="*neutral_800",
|
70 |
+
block_background_fill_dark="*neutral_800",
|
71 |
+
block_border_color="*border_color_primary",
|
72 |
+
block_border_color_dark="*border_color_primary",
|
73 |
+
block_border_width="1px",
|
74 |
+
block_border_width_dark="1px",
|
75 |
+
block_info_text_color="*body_text_color_subdued",
|
76 |
+
block_info_text_color_dark="*body_text_color_subdued",
|
77 |
+
block_info_text_size="*text_sm",
|
78 |
+
block_info_text_weight="400",
|
79 |
+
block_label_background_fill="*background_fill_primary",
|
80 |
+
block_label_background_fill_dark="*background_fill_secondary",
|
81 |
+
block_label_border_color="*border_color_primary",
|
82 |
+
block_label_border_color_dark="*border_color_primary",
|
83 |
+
block_label_border_width="1px",
|
84 |
+
block_label_border_width_dark="1px",
|
85 |
+
block_label_margin="0",
|
86 |
+
block_label_padding="*spacing_sm *spacing_lg",
|
87 |
+
block_label_radius="calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px) 0",
|
88 |
+
block_label_right_radius="0 calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px)",
|
89 |
+
block_label_shadow="*block_shadow",
|
90 |
+
block_label_text_color="*#110F0F",
|
91 |
+
block_label_text_color_dark="*#110F0F",
|
92 |
+
block_label_text_weight="400",
|
93 |
+
block_padding="*spacing_xl",
|
94 |
+
block_radius="*radius_md",
|
95 |
+
block_shadow="none",
|
96 |
+
block_shadow_dark="none",
|
97 |
+
block_title_background_fill="rgb(255,255,255)",
|
98 |
+
block_title_background_fill_dark="rgb(255,255,255)",
|
99 |
+
block_title_border_color="none",
|
100 |
+
block_title_border_color_dark="none",
|
101 |
+
block_title_border_width="0px",
|
102 |
+
block_title_padding="*block_label_padding",
|
103 |
+
block_title_radius="*block_label_radius",
|
104 |
+
block_title_text_color="#110F0F",
|
105 |
+
block_title_text_color_dark="#110F0F",
|
106 |
+
block_title_text_size="*text_md",
|
107 |
+
block_title_text_weight="600",
|
108 |
+
body_background_fill="#110F0F",
|
109 |
+
body_background_fill_dark="#110F0F",
|
110 |
+
body_text_color="white",
|
111 |
+
body_text_color_dark="white",
|
112 |
+
body_text_color_subdued="*neutral_400",
|
113 |
+
body_text_color_subdued_dark="*neutral_400",
|
114 |
+
body_text_size="*text_md",
|
115 |
+
body_text_weight="400",
|
116 |
+
border_color_accent="*neutral_600",
|
117 |
+
border_color_accent_dark="*neutral_600",
|
118 |
+
border_color_primary="*neutral_800",
|
119 |
+
border_color_primary_dark="*neutral_800",
|
120 |
+
button_border_width="*input_border_width",
|
121 |
+
button_border_width_dark="*input_border_width",
|
122 |
+
button_cancel_background_fill="*button_secondary_background_fill",
|
123 |
+
button_cancel_background_fill_dark="*button_secondary_background_fill",
|
124 |
+
button_cancel_background_fill_hover="*button_cancel_background_fill",
|
125 |
+
button_cancel_background_fill_hover_dark="*button_cancel_background_fill",
|
126 |
+
button_cancel_border_color="*button_secondary_border_color",
|
127 |
+
button_cancel_border_color_dark="*button_secondary_border_color",
|
128 |
+
button_cancel_border_color_hover="*button_cancel_border_color",
|
129 |
+
button_cancel_border_color_hover_dark="*button_cancel_border_color",
|
130 |
+
button_cancel_text_color="#110F0F",
|
131 |
+
button_cancel_text_color_dark="#110F0F",
|
132 |
+
button_cancel_text_color_hover="#110F0F",
|
133 |
+
button_cancel_text_color_hover_dark="#110F0F",
|
134 |
+
button_large_padding="*spacing_lg calc(2 * *spacing_lg)",
|
135 |
+
button_large_radius="*radius_lg",
|
136 |
+
button_large_text_size="*text_lg",
|
137 |
+
button_large_text_weight="600",
|
138 |
+
button_primary_background_fill="*primary_600",
|
139 |
+
button_primary_background_fill_dark="*primary_600",
|
140 |
+
button_primary_background_fill_hover="*primary_500",
|
141 |
+
button_primary_background_fill_hover_dark="*primary_500",
|
142 |
+
button_primary_border_color="*primary_500",
|
143 |
+
button_primary_border_color_dark="*primary_500",
|
144 |
+
button_primary_border_color_hover="*primary_400",
|
145 |
+
button_primary_border_color_hover_dark="*primary_400",
|
146 |
+
button_primary_text_color="white",
|
147 |
+
button_primary_text_color_dark="white",
|
148 |
+
button_primary_text_color_hover="#110F0F",
|
149 |
+
button_primary_text_color_hover_dark="#110F0F",
|
150 |
+
button_secondary_background_fill="transparent",
|
151 |
+
button_secondary_background_fill_dark="transparent",
|
152 |
+
button_secondary_background_fill_hover="*neutral_800",
|
153 |
+
button_secondary_background_fill_hover_dark="*neutral_800",
|
154 |
+
button_secondary_border_color="*neutral_700",
|
155 |
+
button_secondary_border_color_dark="*neutral_700",
|
156 |
+
button_secondary_border_color_hover="*neutral_600",
|
157 |
+
button_secondary_border_color_hover_dark="*neutral_600",
|
158 |
+
button_secondary_text_color="white",
|
159 |
+
button_secondary_text_color_dark="white",
|
160 |
+
button_secondary_text_color_hover="*button_secondary_text_color",
|
161 |
+
button_secondary_text_color_hover_dark="*button_secondary_text_color",
|
162 |
+
button_shadow="none",
|
163 |
+
button_shadow_active="*shadow_inset",
|
164 |
+
button_shadow_hover="none",
|
165 |
+
button_small_padding="*spacing_sm calc(2 * *spacing_sm)",
|
166 |
+
button_small_radius="*radius_lg",
|
167 |
+
button_small_text_size="*text_md",
|
168 |
+
button_small_text_weight="400",
|
169 |
+
button_transition="0.3s ease all",
|
170 |
+
checkbox_background_color="*neutral_700",
|
171 |
+
checkbox_background_color_dark="*neutral_700",
|
172 |
+
checkbox_background_color_focus="*checkbox_background_color",
|
173 |
+
checkbox_background_color_focus_dark="*checkbox_background_color",
|
174 |
+
checkbox_background_color_hover="*checkbox_background_color",
|
175 |
+
checkbox_background_color_hover_dark="*checkbox_background_color",
|
176 |
+
checkbox_background_color_selected="*secondary_600",
|
177 |
+
checkbox_background_color_selected_dark="*secondary_600",
|
178 |
+
checkbox_border_color="*neutral_700",
|
179 |
+
checkbox_border_color_dark="*neutral_700",
|
180 |
+
checkbox_border_color_focus="*secondary_500",
|
181 |
+
checkbox_border_color_focus_dark="*secondary_500",
|
182 |
+
checkbox_border_color_hover="*neutral_600",
|
183 |
+
checkbox_border_color_hover_dark="*neutral_600",
|
184 |
+
checkbox_border_color_selected="*secondary_600",
|
185 |
+
checkbox_border_color_selected_dark="*secondary_600",
|
186 |
+
checkbox_border_radius="*radius_sm",
|
187 |
+
checkbox_border_width="*input_border_width",
|
188 |
+
checkbox_border_width_dark="*input_border_width",
|
189 |
+
checkbox_check="url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\")",
|
190 |
+
checkbox_label_background_fill="transparent",
|
191 |
+
checkbox_label_background_fill_dark="transparent",
|
192 |
+
checkbox_label_background_fill_hover="transparent",
|
193 |
+
checkbox_label_background_fill_hover_dark="transparent",
|
194 |
+
checkbox_label_background_fill_selected="transparent",
|
195 |
+
checkbox_label_background_fill_selected_dark="transparent",
|
196 |
+
checkbox_label_border_color="transparent",
|
197 |
+
checkbox_label_border_color_dark="transparent",
|
198 |
+
checkbox_label_border_color_hover="transparent",
|
199 |
+
checkbox_label_border_color_hover_dark="transparent",
|
200 |
+
checkbox_label_border_width="transparent",
|
201 |
+
checkbox_label_border_width_dark="transparent",
|
202 |
+
checkbox_label_gap="*spacing_lg",
|
203 |
+
checkbox_label_padding="*spacing_md calc(2 * *spacing_md)",
|
204 |
+
checkbox_label_shadow="none",
|
205 |
+
checkbox_label_text_color="*body_text_color",
|
206 |
+
checkbox_label_text_color_dark="*body_text_color",
|
207 |
+
checkbox_label_text_color_selected="*checkbox_label_text_color",
|
208 |
+
checkbox_label_text_color_selected_dark="*checkbox_label_text_color",
|
209 |
+
checkbox_label_text_size="*text_md",
|
210 |
+
checkbox_label_text_weight="400",
|
211 |
+
checkbox_shadow="*input_shadow",
|
212 |
+
color_accent="*primary_500",
|
213 |
+
color_accent_soft="*primary_50",
|
214 |
+
color_accent_soft_dark="*neutral_700",
|
215 |
+
container_radius="*radius_xl",
|
216 |
+
embed_radius="*radius_lg",
|
217 |
+
error_background_fill="*background_fill_primary",
|
218 |
+
error_background_fill_dark="*background_fill_primary",
|
219 |
+
error_border_color="*border_color_primary",
|
220 |
+
error_border_color_dark="*border_color_primary",
|
221 |
+
error_border_width="1px",
|
222 |
+
error_border_width_dark="1px",
|
223 |
+
error_text_color="#ef4444",
|
224 |
+
error_text_color_dark="#ef4444",
|
225 |
+
form_gap_width="0px",
|
226 |
+
input_background_fill="*neutral_900",
|
227 |
+
input_background_fill_dark="*neutral_900",
|
228 |
+
input_background_fill_focus="*secondary_600",
|
229 |
+
input_background_fill_focus_dark="*secondary_600",
|
230 |
+
input_background_fill_hover="*input_background_fill",
|
231 |
+
input_background_fill_hover_dark="*input_background_fill",
|
232 |
+
input_border_color="*neutral_700",
|
233 |
+
input_border_color_dark="*neutral_700",
|
234 |
+
input_border_color_focus="*secondary_600",
|
235 |
+
input_border_color_focus_dark="*primary_600",
|
236 |
+
input_border_color_hover="*input_border_color",
|
237 |
+
input_border_color_hover_dark="*input_border_color",
|
238 |
+
input_border_width="1px",
|
239 |
+
input_border_width_dark="1px",
|
240 |
+
input_padding="*spacing_xl",
|
241 |
+
input_placeholder_color="*neutral_500",
|
242 |
+
input_placeholder_color_dark="*neutral_500",
|
243 |
+
input_radius="*radius_lg",
|
244 |
+
input_shadow="none",
|
245 |
+
input_shadow_dark="none",
|
246 |
+
input_shadow_focus="*input_shadow",
|
247 |
+
input_shadow_focus_dark="*input_shadow",
|
248 |
+
input_text_size="*text_md",
|
249 |
+
input_text_weight="400",
|
250 |
+
layout_gap="*spacing_xxl",
|
251 |
+
link_text_color="*secondary_500",
|
252 |
+
link_text_color_active="*secondary_500",
|
253 |
+
link_text_color_active_dark="*secondary_500",
|
254 |
+
link_text_color_dark="*secondary_500",
|
255 |
+
link_text_color_hover="*secondary_400",
|
256 |
+
link_text_color_hover_dark="*secondary_400",
|
257 |
+
link_text_color_visited="*secondary_600",
|
258 |
+
link_text_color_visited_dark="*secondary_600",
|
259 |
+
loader_color="*color_accent",
|
260 |
+
loader_color_dark="*color_accent",
|
261 |
+
panel_background_fill="*background_fill_secondary",
|
262 |
+
panel_background_fill_dark="*background_fill_secondary",
|
263 |
+
panel_border_color="*border_color_primary",
|
264 |
+
panel_border_color_dark="*border_color_primary",
|
265 |
+
panel_border_width="1px",
|
266 |
+
panel_border_width_dark="1px",
|
267 |
+
prose_header_text_weight="600",
|
268 |
+
prose_text_size="*text_md",
|
269 |
+
prose_text_weight="400",
|
270 |
+
radio_circle="url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e\")",
|
271 |
+
section_header_text_size="*text_md",
|
272 |
+
section_header_text_weight="400",
|
273 |
+
shadow_drop="rgba(0,0,0,0.05) 0px 1px 2px 0px",
|
274 |
+
shadow_drop_lg="0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
275 |
+
shadow_inset="rgba(0,0,0,0.05) 0px 2px 4px 0px inset",
|
276 |
+
shadow_spread="3px",
|
277 |
+
shadow_spread_dark="1px",
|
278 |
+
slider_color="#9E9E9E",
|
279 |
+
slider_color_dark="#9E9E9E",
|
280 |
+
stat_background_fill="*primary_500",
|
281 |
+
stat_background_fill_dark="*primary_500",
|
282 |
+
table_border_color="*neutral_700",
|
283 |
+
table_border_color_dark="*neutral_700",
|
284 |
+
table_even_background_fill="*neutral_950",
|
285 |
+
table_even_background_fill_dark="*neutral_950",
|
286 |
+
table_odd_background_fill="*neutral_900",
|
287 |
+
table_odd_background_fill_dark="*neutral_900",
|
288 |
+
table_radius="*radius_lg",
|
289 |
+
table_row_focus="*color_accent_soft",
|
290 |
+
table_row_focus_dark="*color_accent_soft",
|
291 |
+
)
|
292 |
+
|
293 |
+
|
294 |
+
applio = Applio()
|
295 |
+
|
296 |
+
|
297 |
+
|
298 |
+
|
299 |
+
|
300 |
+
|
301 |
def separator(audio):
|
302 |
os.makedirs("output", exist_ok=True)
|
303 |
write('test.wav', audio[0], audio[1])
|
|
|
336 |
file_path = download_audio(url)
|
337 |
return file_path
|
338 |
|
339 |
+
with gr.Blocks(theme=applio) as demo:
|
340 |
+
gr.Markdown(" BS FORMER ESPARATION!")
|
341 |
+
with gr.Tab("main"):
|
342 |
audio_input = gr.Audio(type="numpy", label="Input")
|
343 |
output1 = gr.Audio(type="filepath", label="Stem 1", interactive=False)
|
344 |
output2 = gr.Audio(type="filepath", label="Stem 2", interactive=False)
|
|
|
348 |
inputs=[audio_input],
|
349 |
outputs=[output1, output2]
|
350 |
)
|
351 |
+
gr.Markdown("Download YouTube audio for separation"):
|
352 |
url = gr.Textbox(label="URL to YouTube")
|
353 |
download = gr.Button("Download")
|
354 |
download.click(
|