roychao19477 commited on
Commit
f299c53
·
1 Parent(s): b96cebe
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -2,6 +2,7 @@ import shlex
2
  import subprocess
3
  import spaces
4
  import torch
 
5
 
6
  # install packages for mamba
7
  def install_mamba():
@@ -12,8 +13,13 @@ def install_mamba():
12
 
13
  install_mamba()
14
 
 
 
 
 
 
 
15
 
16
- import gradio as gr
17
  import torch
18
  import yaml
19
  import librosa
@@ -48,6 +54,7 @@ model.load_state_dict(sdict["generator"])
48
  model.eval()
49
 
50
 
 
51
 
52
  @spaces.GPU
53
  def enhance(filepath):
@@ -77,17 +84,13 @@ def enhance(filepath):
77
  librosa.display.specshow(S, sr=orig_sr, hop_length=512, x_axis="time", y_axis="hz", ax=ax)
78
  ax.set_title("Enhanced Spectrogram")
79
  plt.colorbar(format="%+2.0f dB", ax=ax)
 
80
  return out, fig
81
 
82
- ABOUT = """
83
- # SEMamba: Speech Enhancement
84
- A Mamba-based model that denoises real-world audio.
85
- Upload or record a noisy clip and click **Enhance** to hear + see its spectrogram.
86
- """
87
 
88
  with gr.Blocks() as demo:
89
  gr.Markdown(ABOUT)
90
- audio_in = gr.Audio(label="Your Noisy Audio",
91
  type="filepath",
92
  interactive=True)
93
  run_button = gr.Button("Enhance", variant="primary")
 
2
  import subprocess
3
  import spaces
4
  import torch
5
+ import gradio as gr
6
 
7
  # install packages for mamba
8
  def install_mamba():
 
13
 
14
  install_mamba()
15
 
16
+ ABOUT = """
17
+ # SEMamba: Speech Enhancement
18
+ A Mamba-based model that denoises real-world audio.
19
+ Upload or record a noisy clip and click **Enhance** to hear + see its spectrogram.
20
+ """
21
+
22
 
 
23
  import torch
24
  import yaml
25
  import librosa
 
54
  model.eval()
55
 
56
 
57
+
58
 
59
  @spaces.GPU
60
  def enhance(filepath):
 
84
  librosa.display.specshow(S, sr=orig_sr, hop_length=512, x_axis="time", y_axis="hz", ax=ax)
85
  ax.set_title("Enhanced Spectrogram")
86
  plt.colorbar(format="%+2.0f dB", ax=ax)
87
+
88
  return out, fig
89
 
 
 
 
 
 
90
 
91
  with gr.Blocks() as demo:
92
  gr.Markdown(ABOUT)
93
+ audio_in = gr.Audio(label="Audio",
94
  type="filepath",
95
  interactive=True)
96
  run_button = gr.Button("Enhance", variant="primary")