srinikesh1432 commited on
Commit
74676ee
·
verified ·
1 Parent(s): 4261c3f

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +21 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load audio classification pipeline
5
+ classifier = pipeline("audio-classification", model="superb/wav2vec2-base-superb-ks")
6
+
7
+ def classify_audio(audio):
8
+ # audio is (sample_rate, numpy array)
9
+ return classifier(audio)
10
+
11
+ # Gradio UI
12
+ demo = gr.Interface(
13
+ fn=classify_audio,
14
+ inputs=gr.Audio(type="filepath"),
15
+ outputs=gr.Label(num_top_classes=5),
16
+ title="Audio Classification",
17
+ description="Upload an audio file and classify the sound (e.g., speech, music, etc.)."
18
+ )
19
+
20
+ if __name__ == "__main__":
21
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ transformers
2
+ torch
3
+ torchaudio
4
+ gradio