denoising-unet / app.py
cwitkowitz's picture
initial commit
5ff96b2
from pyharp import *
import gradio as gr
import os
model_card = ModelCard(
name='Denoising U-Net',
description='A two-stage U-Net for high-fidelity denoising of historical gramophone recordings.',
author='Eloi Moliner and Vesa Välimäki',
tags=['Music', 'Denoising', 'U-Net', 'High-Fidelity', 'Historical']
)
def process_fn(input_audio_path):
"""
This function defines the audio processing steps
Args:
input_audio_path (str): the audio filepath to be processed.
<YOUR_KWARGS>: additional keyword arguments necessary for processing.
NOTE: These should correspond to and match order of UI elements defined below.
Returns:
output_audio_path (str): the filepath of the processed audio.
output_labels (LabelList): any labels to display.
"""
os.system("python inference.py inference.audio=" + input_audio_path)
output_audio_path = input_audio_path[:-4] + "_denoised.wav"
# No output labels
output_labels = LabelList()
return output_audio_path, output_labels
# Build Gradio endpoint
with gr.Blocks() as demo:
# Define Gradio Components
components = []
app = build_endpoint(model_card=model_card,
components=components,
process_fn=process_fn)
demo.queue()
demo.launch(share=True, show_error=True)