Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# audio_classification_app.py
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from transformers import pipeline
|
| 4 |
+
|
| 5 |
+
classifier = pipeline("audio-classification", model="superb/wav2vec2-base-superb-ks")
|
| 6 |
+
|
| 7 |
+
def classify_audio(audio_file):
|
| 8 |
+
return classifier(audio_file)
|
| 9 |
+
|
| 10 |
+
demo = gr.Interface(
|
| 11 |
+
fn=classify_audio,
|
| 12 |
+
inputs=gr.Audio(type="filepath"),
|
| 13 |
+
outputs=gr.Label(num_top_classes=5),
|
| 14 |
+
title="Audio Classification",
|
| 15 |
+
description="Upload or record audio to classify (keywords dataset model)."
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
if __name__ == "__main__":
|
| 19 |
+
demo.launch()
|