Spaces:
Sleeping
Sleeping
import librosa | |
import numpy as np | |
import gradio as gr | |
def get_bpm(file): | |
y, sr = librosa.load(file.name) | |
tempo, beats = librosa.beat.tempo(y=y, sr=sr, aggregate=None) | |
return np.mean(tempo) | |
demo = gr.Interface( | |
fn=get_bpm, | |
inputs=gr.Audio(label="Audio File"), | |
outputs=gr.Number(label="BPM"), | |
title="BPM Detector", | |
description="Upload an audio file to get its BPM", | |
) | |
if __name__ == "__main__": | |
demo.launch() |