Ahmed107 commited on
Commit
57a760c
·
verified ·
1 Parent(s): 5144085

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -1,7 +1,15 @@
1
- from transformers import pipeline
2
 
3
  model_id = "Ahmed107/whisper-tiny-finetuned-eos"
4
- pipe = pipeline("audio-classification", model=model_id)
 
 
 
 
 
 
 
 
5
 
6
  def classify_audio(filepath):
7
  preds = pipe(filepath)
 
1
+ from transformers import pipeline,AutoConfig,AutoModelForAudioClassification
2
 
3
  model_id = "Ahmed107/whisper-tiny-finetuned-eos"
4
+
5
+ # define mappings as dictionaries
6
+ id2label = {"0": "NOT_EOS", "1": "EOS"}
7
+ label2id = {"NOT_EOS": "0", "EOS": "1"}
8
+
9
+ # define config
10
+ config = AutoConfig.from_pretrained(model_id, label2id=label2id, id2label=id2label)
11
+ model = AutoModelForAudioClassification.from_pretrained(model_id, config = config)
12
+ pipe = pipeline("audio-classification", model=model)
13
 
14
  def classify_audio(filepath):
15
  preds = pipe(filepath)