Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,15 @@
|
|
1 |
-
from transformers import pipeline
|
2 |
|
3 |
model_id = "Ahmed107/whisper-tiny-finetuned-eos"
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|