Politrees commited on
Commit
e075d2a
·
verified ·
1 Parent(s): ce5eee2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -336,7 +336,13 @@ def demucs_separator(audio, model, seg_size, shifts, overlap, segments_enabled,
336
  except Exception as e:
337
  raise RuntimeError(f"Demucs separation failed: {e}") from e
338
 
339
- # Обновленный интерфейс
 
 
 
 
 
 
340
  with gr.Blocks(
341
  title="🎵 PolUVR 🎵",
342
  css="footer{display:none !important}",
@@ -433,6 +439,7 @@ with gr.Blocks(
433
  with gr.Row():
434
  demucs_stem1 = gr.Audio(label="Stem 1", type="filepath", interactive=False)
435
  demucs_stem2 = gr.Audio(label="Stem 2", type="filepath", interactive=False)
 
436
  demucs_stem3 = gr.Audio(label="Stem 3", type="filepath", interactive=False)
437
  demucs_stem4 = gr.Audio(label="Stem 4", type="filepath", interactive=False)
438
  with gr.Row(visible=False) as stem6:
@@ -448,7 +455,7 @@ with gr.Blocks(
448
  output_format = gr.Dropdown(value="wav", choices=["wav", "flac", "mp3"], label="Output Format", info="The format of the output audio file.")
449
  with gr.Row():
450
  norm_threshold = gr.Slider(minimum=0.1, maximum=1, step=0.1, value=0.9, label="Normalization threshold", info="The threshold for audio normalization.")
451
- amp_threshold = gr.Slider(minimum=0.1, maximum=1, step=0.1, value=0.0, label="Amplification threshold", info="The threshold for audio amplification.")
452
  with gr.Row():
453
  batch_size = gr.Slider(minimum=1, maximum=16, step=1, value=1, label="Batch Size", info="Larger consumes more RAM but may process slightly faster.")
454
 
@@ -599,7 +606,7 @@ with gr.Blocks(
599
  )
600
 
601
  def main():
602
- app.launch(share=True)
603
 
604
  if __name__ == "__main__":
605
  main()
 
336
  except Exception as e:
337
  raise RuntimeError(f"Demucs separation failed: {e}") from e
338
 
339
+ def update_stems(model):
340
+ """Update the visibility of stem outputs based on the selected Demucs model."""
341
+ if model == "htdemucs_6s.yaml":
342
+ return gr.update(visible=True)
343
+ else:
344
+ return gr.update(visible=False)
345
+
346
  with gr.Blocks(
347
  title="🎵 PolUVR 🎵",
348
  css="footer{display:none !important}",
 
439
  with gr.Row():
440
  demucs_stem1 = gr.Audio(label="Stem 1", type="filepath", interactive=False)
441
  demucs_stem2 = gr.Audio(label="Stem 2", type="filepath", interactive=False)
442
+ with gr.Row():
443
  demucs_stem3 = gr.Audio(label="Stem 3", type="filepath", interactive=False)
444
  demucs_stem4 = gr.Audio(label="Stem 4", type="filepath", interactive=False)
445
  with gr.Row(visible=False) as stem6:
 
455
  output_format = gr.Dropdown(value="wav", choices=["wav", "flac", "mp3"], label="Output Format", info="The format of the output audio file.")
456
  with gr.Row():
457
  norm_threshold = gr.Slider(minimum=0.1, maximum=1, step=0.1, value=0.9, label="Normalization threshold", info="The threshold for audio normalization.")
458
+ amp_threshold = gr.Slider(minimum=0.0, maximum=1, step=0.1, value=0.0, label="Amplification threshold", info="The threshold for audio amplification.")
459
  with gr.Row():
460
  batch_size = gr.Slider(minimum=1, maximum=16, step=1, value=1, label="Batch Size", info="Larger consumes more RAM but may process slightly faster.")
461
 
 
606
  )
607
 
608
  def main():
609
+ app.launch(share=True, debug=True)
610
 
611
  if __name__ == "__main__":
612
  main()