Tirath5504 commited on
Commit
0ed4adc
1 Parent(s): 83d8dae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -1,10 +1,8 @@
1
- from transformers import pipeline, Wav2Vec2Processor, Wav2Vec2ForSequenceClassification
2
  import gradio as gr
3
 
4
  model_id = "Tirath5504/distilhubert-finetuned-gtzan"
5
- processor = Wav2Vec2Processor.from_pretrained(model_id)
6
- model = Wav2Vec2ForSequenceClassification.from_pretrained(model_id)
7
- pipe = pipeline("audio-classification", model=model, processor=processor)
8
 
9
  def classify_audio(filepath):
10
  preds = pipe(filepath)
@@ -14,6 +12,6 @@ def classify_audio(filepath):
14
  return outputs
15
 
16
  demo = gr.Interface(
17
- fn=classify_audio, inputs=gr.Audio(type="filepath"), outputs=gr.outputs.Label()
18
  )
19
  demo.launch(debug=True)
 
1
+ from transformers import pipeline
2
  import gradio as gr
3
 
4
  model_id = "Tirath5504/distilhubert-finetuned-gtzan"
5
+ pipe = pipeline("audio-classification", model=model_id)
 
 
6
 
7
  def classify_audio(filepath):
8
  preds = pipe(filepath)
 
12
  return outputs
13
 
14
  demo = gr.Interface(
15
+ fn=classify_audio, inputs=gr.Audio(type="filepath"), outputs=gr.Label(), live=True
16
  )
17
  demo.launch(debug=True)