Spaces:
Running
Running
Upload 3 files
Browse filesAI Audio Denoiser β Remove Background Noise Instantly
This is a commercial-grade, proprietary audio denoising algorithm designed to clean noisy audio clips using AI and DSP.
π― Ideal for:
Podcasters, YouTubers, and streamers
Call center recordings and voice notes
SaaS platforms with noisy audio inputs
π§ Built with [ConvTasNet / FFT / Custom DSP]
βοΈ Available as API, SDK, or on-premises solution

π Contact us for integration or licensing: [email protected]
π This demo is for evaluation only. All rights reserved.
- README.md +7 -14
- app.py +86 -0
- requirements.txt +7 -0
README.md
CHANGED
|
@@ -1,14 +1,7 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: other
|
| 11 |
-
short_description: 'AI Audio Denoiser β Removes Background Noise '
|
| 12 |
-
---
|
| 13 |
-
|
| 14 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
+
# π§ ConvTasNet AI Audio Denoiser
|
| 2 |
+
|
| 3 |
+
Upload noisy audio clips to get clean, denoised audio using a state-of-the-art ConvTasNet model.
|
| 4 |
+
|
| 5 |
+
> β οΈ This demo is for evaluation only. Commercial use is prohibited without permission.
|
| 6 |
+
|
| 7 |
+
Contact: itsdevansh57@gmail.com
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torchaudio
|
| 3 |
+
import soundfile as sf
|
| 4 |
+
import librosa
|
| 5 |
+
import librosa.display
|
| 6 |
+
import matplotlib.pyplot as plt
|
| 7 |
+
import numpy as np
|
| 8 |
+
from asteroid.models import BaseModel
|
| 9 |
+
import gradio as gr
|
| 10 |
+
import os
|
| 11 |
+
import uuid
|
| 12 |
+
|
| 13 |
+
# Load pretrained ConvTasNet model
|
| 14 |
+
print("Loading model...")
|
| 15 |
+
model = BaseModel.from_pretrained("JorisCos/ConvTasNet_Libri2Mix_sepnoisy_16k")
|
| 16 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 17 |
+
model = model.to(device).eval()
|
| 18 |
+
print("Model loaded successfully β
")
|
| 19 |
+
|
| 20 |
+
def denoise_and_visualize(audio_path):
|
| 21 |
+
if audio_path is None:
|
| 22 |
+
return "Please upload an audio file.", None, None, None
|
| 23 |
+
|
| 24 |
+
try:
|
| 25 |
+
# Unique ID to avoid overwriting files
|
| 26 |
+
uid = str(uuid.uuid4())
|
| 27 |
+
output_dir = "outputs"
|
| 28 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 29 |
+
|
| 30 |
+
# Load & resample input to 16kHz mono
|
| 31 |
+
wav, sr = torchaudio.load(audio_path)
|
| 32 |
+
if sr != 16000:
|
| 33 |
+
wav = torchaudio.functional.resample(wav, sr, 16000)
|
| 34 |
+
wav = wav.mean(dim=0, keepdim=True).to(device)
|
| 35 |
+
|
| 36 |
+
# Model inference
|
| 37 |
+
with torch.no_grad():
|
| 38 |
+
est_sources = model.separate(wav)
|
| 39 |
+
clean_audio = est_sources[:, 0, :].cpu().squeeze().numpy()
|
| 40 |
+
|
| 41 |
+
# Save output audio
|
| 42 |
+
audio_output = os.path.join(output_dir, f"cleaned_{uid}.wav")
|
| 43 |
+
sf.write(audio_output, clean_audio, 16000)
|
| 44 |
+
|
| 45 |
+
# Create spectrograms
|
| 46 |
+
orig, _ = librosa.load(audio_path, sr=sr)
|
| 47 |
+
den, _ = librosa.load(audio_output, sr=16000)
|
| 48 |
+
|
| 49 |
+
plt.figure(figsize=(12, 5))
|
| 50 |
+
plt.subplot(1, 2, 1)
|
| 51 |
+
D_orig = librosa.amplitude_to_db(np.abs(librosa.stft(orig)), ref=np.max)
|
| 52 |
+
librosa.display.specshow(D_orig, sr=sr, y_axis='log', x_axis='time')
|
| 53 |
+
plt.title("Original Noisy")
|
| 54 |
+
plt.colorbar(format='%+2.0f dB')
|
| 55 |
+
|
| 56 |
+
plt.subplot(1, 2, 2)
|
| 57 |
+
D_clean = librosa.amplitude_to_db(np.abs(librosa.stft(den)), ref=np.max)
|
| 58 |
+
librosa.display.specshow(D_clean, sr=16000, y_axis='log', x_axis='time')
|
| 59 |
+
plt.title("Denoised Output")
|
| 60 |
+
plt.colorbar(format='%+2.0f dB')
|
| 61 |
+
|
| 62 |
+
plt.tight_layout()
|
| 63 |
+
spectrogram_output = os.path.join(output_dir, f"spectrogram_{uid}.png")
|
| 64 |
+
plt.savefig(spectrogram_output)
|
| 65 |
+
plt.close()
|
| 66 |
+
|
| 67 |
+
return "β
Denoising complete!", audio_output, spectrogram_output, (16000, clean_audio)
|
| 68 |
+
|
| 69 |
+
except Exception as e:
|
| 70 |
+
return f"Error processing audio: {e}", None, None, None
|
| 71 |
+
|
| 72 |
+
# Gradio UI
|
| 73 |
+
iface = gr.Interface(
|
| 74 |
+
fn=denoise_and_visualize,
|
| 75 |
+
inputs=gr.Audio(type="filepath", label="Upload Noisy Audio"),
|
| 76 |
+
outputs=[
|
| 77 |
+
gr.Textbox(label="Status"),
|
| 78 |
+
gr.Audio(label="Denoised Audio"),
|
| 79 |
+
gr.Image(label="Spectrogram Comparison"),
|
| 80 |
+
gr.Audio(label="Denoised Audio (16kHz)"),
|
| 81 |
+
],
|
| 82 |
+
title="ConvTasNet AI Audio Denoiser",
|
| 83 |
+
description="Upload a noisy audio file. This app removes background noise using ConvTasNet. Spectrograms show before & after.",
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
iface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
torchaudio
|
| 3 |
+
gradio
|
| 4 |
+
librosa
|
| 5 |
+
matplotlib
|
| 6 |
+
soundfile
|
| 7 |
+
asteroid
|