hugofloresgarcia commited on
Commit
6f034db
β€’
1 Parent(s): a9e7471
Files changed (3) hide show
  1. .gitignore +1 -0
  2. README.md +1 -1
  3. app.py +7 -4
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ _outputs
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: πŸ“š
4
  colorFrom: pink
5
  colorTo: green
6
  sdk: gradio
7
- sdk_version: 3.45.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: pink
5
  colorTo: green
6
  sdk: gradio
7
+ sdk_version: 4.7.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
app.py CHANGED
@@ -32,12 +32,12 @@ def hpss(signal: AudioSignal, **kwargs):
32
 
33
  MIN_DB = -120
34
 
35
- def process_fn(audio_file,
36
  harmonic_db: float,
37
  percussive_db: float,
38
  kernel_size: int = 31,
39
  margin: float = 1.0):
40
- sig = AudioSignal(audio_file)
41
 
42
  harmonic, percussive = hpss(sig, kernel_size=int(kernel_size), margin=margin)
43
 
@@ -53,7 +53,9 @@ def process_fn(audio_file,
53
  + percussive.volume_change(clip(percussive_db))
54
  )
55
 
56
- return save_and_return_filepath(sig)
 
 
57
 
58
  # Create a ModelCard
59
  card = ModelCard(
@@ -98,6 +100,7 @@ with gr.Blocks() as demo:
98
  output = gr.Audio(label="Audio Output", type="filepath")
99
 
100
  # Build the endpoint
101
- ctrls_data, ctrls_button, process_button = build_endpoint(inputs, output, process_fn, card)
102
 
 
103
  demo.launch(share=True)
 
32
 
33
  MIN_DB = -120
34
 
35
+ def process_fn(audio_file_path,
36
  harmonic_db: float,
37
  percussive_db: float,
38
  kernel_size: int = 31,
39
  margin: float = 1.0):
40
+ sig = AudioSignal(audio_file_path)
41
 
42
  harmonic, percussive = hpss(sig, kernel_size=int(kernel_size), margin=margin)
43
 
 
53
  + percussive.volume_change(clip(percussive_db))
54
  )
55
 
56
+ output_audio_path = save_and_return_filepath(sig)
57
+
58
+ return output_audio_path
59
 
60
  # Create a ModelCard
61
  card = ModelCard(
 
100
  output = gr.Audio(label="Audio Output", type="filepath")
101
 
102
  # Build the endpoint
103
+ widgets = build_endpoint(inputs, output, process_fn, card)
104
 
105
+ demo.queue()
106
  demo.launch(share=True)