Update app.py
Browse files
app.py
CHANGED
|
@@ -1,34 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import torch
|
| 3 |
-
from sgmse.model import SGMSENoiseReducer # Adjust import as per your model structure
|
| 4 |
-
import soundfile as sf
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
# Load noisy audio file
|
| 12 |
-
noisy, sr = sf.read(noisy_audio)
|
| 13 |
-
|
| 14 |
-
# Apply your model to enhance the speech
|
| 15 |
-
enhanced_audio = model.enhance(noisy, sr)
|
| 16 |
-
|
| 17 |
-
# Save enhanced audio to a temporary file
|
| 18 |
-
output_file = "enhanced_output.wav"
|
| 19 |
-
sf.write(output_file, enhanced_audio, sr)
|
| 20 |
-
|
| 21 |
-
return output_file
|
| 22 |
-
|
| 23 |
-
# Set up the Gradio interface
|
| 24 |
-
interface = gr.Interface(
|
| 25 |
-
fn=enhance_speech,
|
| 26 |
-
inputs=gr.Audio(source="upload", type="filepath"),
|
| 27 |
-
outputs=gr.Audio(type="file"),
|
| 28 |
-
title="SGMSE Speech Enhancement",
|
| 29 |
-
description="Upload a noisy audio file and download the enhanced (clean) version."
|
| 30 |
-
)
|
| 31 |
-
|
| 32 |
-
# Launch the interface
|
| 33 |
-
if __name__ == "__main__":
|
| 34 |
-
interface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
def greet(name):
|
| 4 |
+
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
+
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|