SaoYear commited on
Commit ·
f1a805c
1
Parent(s): 9afa27d
change mamba install
Browse files- app.py +36 -36
- model/cleanmel.py +5 -1
- requirements.txt +1 -2
app.py
CHANGED
|
@@ -128,41 +128,41 @@ def reset_everything():
|
|
| 128 |
"""Reset all components to initial state"""
|
| 129 |
return None, None, None
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
outputs=[output_audio, output_mel, output_np]
|
| 162 |
-
|
| 163 |
-
clear_btn.click(
|
| 164 |
-
fn=reset_everything,
|
| 165 |
-
outputs=[output_audio, output_mel, output_np]
|
| 166 |
-
)
|
| 167 |
|
| 168 |
-
|
|
|
|
| 128 |
"""Reset all components to initial state"""
|
| 129 |
return None, None, None
|
| 130 |
|
| 131 |
+
|
| 132 |
+
demo = gr.Blocks()
|
| 133 |
+
with gr.Blocks(title="CleanMel Demo") as demo:
|
| 134 |
+
gr.Markdown("## CleanMel Demo")
|
| 135 |
+
gr.Markdown("This demo showcases the CleanMel model for speech enhancement.")
|
| 136 |
+
|
| 137 |
+
with gr.Row():
|
| 138 |
+
audio_input = gr.Audio(label="Input Audio", type="filepath", sources="upload")
|
| 139 |
+
with gr.Column():
|
| 140 |
+
enhance_button_map = gr.Button("Enhance Audio (offline CleanMel_L_map)")
|
| 141 |
+
enhance_button_mask = gr.Button("Enhance Audio (offline CleanMel_L_mask)")
|
| 142 |
+
clear_btn = gr.Button(
|
| 143 |
+
"🗑️ Clear All",
|
| 144 |
+
variant="secondary",
|
| 145 |
+
size="lg"
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
output_audio = gr.Audio(label="Enhanced Audio", type="filepath")
|
| 149 |
+
output_mel = gr.Image(label="Output LogMel Spectrogram", type="filepath", visible=True)
|
| 150 |
+
output_np = gr.File(label="Enhanced LogMel Spec. (.npy)", type="filepath")
|
| 151 |
+
|
| 152 |
+
enhance_button_map.click(
|
| 153 |
+
enhance_cleanmel_L_map,
|
| 154 |
+
inputs=audio_input,
|
| 155 |
+
outputs=[output_audio, output_mel, output_np]
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
enhance_button_mask.click(
|
| 159 |
+
enhance_cleanmel_L_mask,
|
| 160 |
+
inputs=audio_input,
|
| 161 |
+
outputs=[output_audio, output_mel, output_np]
|
| 162 |
+
)
|
| 163 |
+
clear_btn.click(
|
| 164 |
+
fn=reset_everything,
|
| 165 |
outputs=[output_audio, output_mel, output_np]
|
| 166 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
+
demo.launch(debug=False, share=True)
|
model/cleanmel.py
CHANGED
|
@@ -11,7 +11,11 @@ from torch import Tensor
|
|
| 11 |
from torch.nn import Parameter, init
|
| 12 |
from torch.nn.common_types import _size_1_t
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
from mamba_ssm.utils.generation import InferenceParams
|
| 16 |
|
| 17 |
class LinearGroup(nn.Module):
|
|
|
|
| 11 |
from torch.nn import Parameter, init
|
| 12 |
from torch.nn.common_types import _size_1_t
|
| 13 |
|
| 14 |
+
try:
|
| 15 |
+
from mamba_ssm import Mamba
|
| 16 |
+
except:
|
| 17 |
+
import os
|
| 18 |
+
os.system("pip install mamba_ssm==1.2.0.post1")
|
| 19 |
from mamba_ssm.utils.generation import InferenceParams
|
| 20 |
|
| 21 |
class LinearGroup(nn.Module):
|
requirements.txt
CHANGED
|
@@ -12,5 +12,4 @@ PyYAML==6.0.1
|
|
| 12 |
scipy==1.15.3
|
| 13 |
soundfile==0.12.1
|
| 14 |
spaces==0.37.0
|
| 15 |
-
transformers==4.40.1
|
| 16 |
-
mamba_ssm==1.2.0.post1
|
|
|
|
| 12 |
scipy==1.15.3
|
| 13 |
soundfile==0.12.1
|
| 14 |
spaces==0.37.0
|
| 15 |
+
transformers==4.40.1
|
|
|