Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -257,6 +257,13 @@ def preview_masked_area(audio_path, mask_start_point, mask_end_point):
|
|
| 257 |
color_masked_spec_image.save(masked_spec_image_path)
|
| 258 |
|
| 259 |
return masked_spec_image_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
|
| 261 |
css="""
|
| 262 |
div#col-container{
|
|
@@ -316,13 +323,20 @@ with gr.Blocks(css=css) as demo:
|
|
| 316 |
input_spectrogram = gr.Image(label="Input Spectrogram")
|
| 317 |
output_spectrogram = gr.Image(label="Output Spectrogram")
|
| 318 |
|
| 319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
|
| 321 |
submit_btn_img2img.click(
|
| 322 |
fn = infer_img2img,
|
| 323 |
inputs = [prompt_img2img, audio_in_img2img, prompt_strength],
|
| 324 |
outputs = [audio_out_img2img, input_spectrogram, output_spectrogram]
|
| 325 |
-
)
|
| 326 |
|
| 327 |
with gr.Tab("Audio InPainting"):
|
| 328 |
prompt_inp = gr.Textbox(label="Prompt")
|
|
@@ -343,6 +357,19 @@ with gr.Blocks(css=css) as demo:
|
|
| 343 |
input_spectrogram_inp = gr.Image(label="Input Spectrogram")
|
| 344 |
output_spectrogram_inp = gr.Image(label="Output Spectrogram")
|
| 345 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
audio_in_inp.upload(
|
| 347 |
fn = load_input_spectrogram,
|
| 348 |
inputs = [audio_in_inp],
|
|
|
|
| 257 |
color_masked_spec_image.save(masked_spec_image_path)
|
| 258 |
|
| 259 |
return masked_spec_image_path
|
| 260 |
+
|
| 261 |
+
def load_inpaint_example(prompt_inp, audio_path):
|
| 262 |
+
|
| 263 |
+
in_spec_path = load_input_spectrogram(audio_path)
|
| 264 |
+
masked_spec_path = preview_masked_area(audio_path, 256, 768)
|
| 265 |
+
|
| 266 |
+
return in_spec_path, masked_spec_path
|
| 267 |
|
| 268 |
css="""
|
| 269 |
div#col-container{
|
|
|
|
| 323 |
input_spectrogram = gr.Image(label="Input Spectrogram")
|
| 324 |
output_spectrogram = gr.Image(label="Output Spectrogram")
|
| 325 |
|
| 326 |
+
gr.Examples(
|
| 327 |
+
examples = [
|
| 328 |
+
["Ambulance siren", "./notebooks/examples/img2img/GIOApFAWDOc_160.wav"],
|
| 329 |
+
["A cat is moewing", "./notebooks/examples/img2img/YniwgMbB6tpQ_01.wav"],
|
| 330 |
+
["A car racing", "./notebooks/examples/img2img/_GI7meqlYZk_30.wav"]
|
| 331 |
+
],
|
| 332 |
+
inputs = [prompt_img2img, audio_in_img2img]
|
| 333 |
+
)
|
| 334 |
|
| 335 |
submit_btn_img2img.click(
|
| 336 |
fn = infer_img2img,
|
| 337 |
inputs = [prompt_img2img, audio_in_img2img, prompt_strength],
|
| 338 |
outputs = [audio_out_img2img, input_spectrogram, output_spectrogram]
|
| 339 |
+
)
|
| 340 |
|
| 341 |
with gr.Tab("Audio InPainting"):
|
| 342 |
prompt_inp = gr.Textbox(label="Prompt")
|
|
|
|
| 357 |
input_spectrogram_inp = gr.Image(label="Input Spectrogram")
|
| 358 |
output_spectrogram_inp = gr.Image(label="Output Spectrogram")
|
| 359 |
|
| 360 |
+
gr.Examples(
|
| 361 |
+
examples = [
|
| 362 |
+
["A siren ringing with a vehicle speeding closer", "./notebooks/examples/inpainting/IvfaKPDWC00_160.wav"],
|
| 363 |
+
["A woman speaking", "./notebooks/examples/inpainting/9z8XIRyUq9Q_30.wav"],
|
| 364 |
+
["An infant crying", "./notebooks/examples/inpainting/14ekd4nkpwc_28.wav"],
|
| 365 |
+
["A dog barking and growling", "./notebooks/examples/inpainting/3ek-xLwr05Q_30.wav"]
|
| 366 |
+
],
|
| 367 |
+
fn = load_inpaint_example,
|
| 368 |
+
inputs = [prompt_inp, audio_in_inp],
|
| 369 |
+
outputs = [masked_spec_preview],
|
| 370 |
+
queue = False
|
| 371 |
+
)
|
| 372 |
+
|
| 373 |
audio_in_inp.upload(
|
| 374 |
fn = load_input_spectrogram,
|
| 375 |
inputs = [audio_in_inp],
|