yoyolicoris commited on
Commit
f4d4abb
·
1 Parent(s): 6bd65db

feat: read device configuration from DEVICE.txt

Browse files
Files changed (2) hide show
  1. DEVICE.txt +1 -0
  2. app.py +24 -3
DEVICE.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ cpu
app.py CHANGED
@@ -47,7 +47,8 @@ Try to play around with the sliders and buttons and see what you can come up wit
47
  > **_Note:_** To upload your own audio, click X on the top right corner of the input audio block.
48
  """
49
 
50
- DEVICE = "cpu"
 
51
  SLIDER_MAX = 3
52
  SLIDER_MIN = -3
53
  NUMBER_OF_PCS = 4
@@ -477,7 +478,7 @@ with gr.Blocks() as demo:
477
  wet_output = default_audio_block(label="Wet Audio", interactive=False)
478
 
479
  with gr.Row():
480
- render_button = gr.Button("Run", elem_id="render-button", variant="primary")
481
  reset_button = gr.Button("Reset", elem_id="reset-button")
482
 
483
  _ = gr.Markdown("## Common Parameters")
@@ -557,7 +558,7 @@ with gr.Blocks() as demo:
557
  interactive=True,
558
  )
559
 
560
- render_button.click(
561
  chain_functions(
562
  # lambda audio, ratio, x, *all_s: (
563
  # audio,
@@ -595,5 +596,25 @@ with gr.Blocks() as demo:
595
  ],
596
  )
597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
 
599
  demo.launch()
 
47
  > **_Note:_** To upload your own audio, click X on the top right corner of the input audio block.
48
  """
49
 
50
+ # DEVICE = "cpu"
51
+ DEVICE = Path("DEVICE.txt").read_text()
52
  SLIDER_MAX = 3
53
  SLIDER_MIN = -3
54
  NUMBER_OF_PCS = 4
 
478
  wet_output = default_audio_block(label="Wet Audio", interactive=False)
479
 
480
  with gr.Row():
481
+ process_button = gr.Button("Run", elem_id="render-button", variant="primary")
482
  reset_button = gr.Button("Reset", elem_id="reset-button")
483
 
484
  _ = gr.Markdown("## Common Parameters")
 
558
  interactive=True,
559
  )
560
 
561
+ process_button.click(
562
  chain_functions(
563
  # lambda audio, ratio, x, *all_s: (
564
  # audio,
 
596
  ],
597
  )
598
 
599
+ remove_approx_checkbox.change(
600
+ lambda in_audio, out_audio, di, wet, *args: (
601
+ (out_audio, di, wet) if in_audio is None else render(in_audio, *args)
602
+ ),
603
+ inputs=[
604
+ audio_input,
605
+ audio_output,
606
+ direct_output,
607
+ wet_output,
608
+ remove_approx_checkbox,
609
+ dry_wet_ratio,
610
+ fx_params,
611
+ ],
612
+ outputs=[
613
+ audio_output,
614
+ direct_output,
615
+ wet_output,
616
+ ],
617
+ )
618
+
619
 
620
  demo.launch()