Spaces:
Sleeping
Sleeping
sebdef123 commited on
Commit ·
dfd7d50
1
Parent(s): 69884f1
instruments model
Browse files- .DS_Store +0 -0
- app.py +9 -8
- double-bass.jpg +0 -0
- grizzly.jpg +0 -0
- guitare.jpeg +0 -0
- export.pkl → model/jazzinstruments.pkl +2 -2
- saxophone.jpeg +0 -0
.DS_Store
CHANGED
|
Binary files a/.DS_Store and b/.DS_Store differ
|
|
|
app.py
CHANGED
|
@@ -1,22 +1,23 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastai.vision.all import *
|
| 3 |
-
|
| 4 |
-
learn = load_learner('
|
| 5 |
|
| 6 |
labels = learn.dls.vocab
|
|
|
|
| 7 |
def predict(img):
|
| 8 |
img = PILImage.create(img)
|
| 9 |
pred,pred_idx,probs = learn.predict(img)
|
| 10 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 11 |
|
| 12 |
-
title = "
|
| 13 |
-
description = "A
|
| 14 |
-
article="
|
| 15 |
-
examples = [
|
| 16 |
interpretation='default'
|
| 17 |
enable_queue=True
|
| 18 |
|
| 19 |
gr.Interface(fn=predict,
|
| 20 |
inputs=gr.Image(type="pil"),
|
| 21 |
-
outputs=gr.Label(num_top_classes=
|
| 22 |
-
examples=["
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastai.vision.all import *
|
| 3 |
+
model_dir='model/'
|
| 4 |
+
learn = load_learner(model_dir+'jazzinstruments.pkl')
|
| 5 |
|
| 6 |
labels = learn.dls.vocab
|
| 7 |
+
labels
|
| 8 |
def predict(img):
|
| 9 |
img = PILImage.create(img)
|
| 10 |
pred,pred_idx,probs = learn.predict(img)
|
| 11 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 12 |
|
| 13 |
+
title = "Jazz Instruments Classifer"
|
| 14 |
+
description = "A Jazz Instrument trained on a dataset create imagesearch : doublebasses, drumkits, guitars, saxophones, clarinettes"
|
| 15 |
+
article=""
|
| 16 |
+
examples = ["guitare.jpeg","double-bass.jpg","saxophone.jpeg"]
|
| 17 |
interpretation='default'
|
| 18 |
enable_queue=True
|
| 19 |
|
| 20 |
gr.Interface(fn=predict,
|
| 21 |
inputs=gr.Image(type="pil"),
|
| 22 |
+
outputs=gr.Label(num_top_classes=5),
|
| 23 |
+
examples=["guitare.jpeg","double-bass.jpg","saxophone.jpeg"]).launch()
|
double-bass.jpg
ADDED
|
grizzly.jpg
DELETED
|
Binary file (34.2 kB)
|
|
|
guitare.jpeg
ADDED
|
export.pkl → model/jazzinstruments.pkl
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e6f0687385bbc380e7f76831d88b69963c30c4cce62dd95ef6e56abb4ee0d1b6
|
| 3 |
+
size 46976566
|
saxophone.jpeg
ADDED
|