File size: 2,146 Bytes
6d69363
973bb39
 
f1f5157
 
e3532f0
 
d0d39bc
e3532f0
791347f
f1f5157
 
 
 
 
 
 
07630c7
36bc51d
33e40de
 
3a161c0
973bb39
 
f1f5157
 
 
 
973bb39
f1f5157
973bb39
f1f5157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import transformers
from transformers import pipeline
import gradio as gr
import pandas
import matplotlib.pyplot as plt
import os 
import sys
os.system('python -m pip install --upgrade pip')
os.system('pip install -U scikit-learn scipy matplotlib')
#import scikit-learn
from sklearn import model_selection
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
os.system("pip install git+https://github.com/openai/whisper.git")
import whisper
# os.system("pip install numpy==1.20.0")
# os.system("pip install numba==0.53")
# os.system("python -c import numba==0.53")


whisper_esc50 = pipeline(model="mskov/whisper_esc50")  
whisper_miso= pipeline(model="mskov/whisper_miso")  
whisper_tiny = whisper.load_model("tiny")
whisper_base = whisper.load_model("base")

dataset = load_dataset("mskov/miso_test")

names = ['path', 'file_name', 'category']
dataframe = pandas.read_csv(url, names=names)
array = dataframe.values
X = array[:,0:2]
Y = array[:,2]
# prepare configuration for cross validation test harness
seed = 7
# prepare models
models = [whisper_esc50, whisper_miso, whisper_tiny, whisper_base]
models.append(('LR', LogisticRegression()))
models.append(('LDA', LinearDiscriminantAnalysis()))
models.append(('KNN', KNeighborsClassifier()))
models.append(('CART', DecisionTreeClassifier()))
models.append(('NB', GaussianNB()))
models.append(('SVM', SVC()))
# evaluate each model in turn
results = []
names = []
scoring = 'accuracy'
for name, model in models:
 kfold = model_selection.KFold(n_splits=10, random_state=seed)
 cv_results = model_selection.cross_val_score(model, X, Y, cv=kfold, scoring=scoring)
 results.append(cv_results)
 names.append(name)
 msg = "%s: %f (%f)" % (name, cv_results.mean(), cv_results.std())
 print(msg)
# boxplot algorithm comparison
fig = plt.figure()
fig.suptitle('Algorithm Comparison')
ax = fig.add_subplot(111)
plt.boxplot(results)
ax.set_xticklabels(names)
plt.show()