Spaces:
Sleeping
Sleeping
Dangurangu
commited on
Commit
•
41237f9
1
Parent(s):
4db8031
Upload 7 files
Browse files- Mbira Classifier.ipynb +0 -0
- app.py +18 -0
- export.pkl +3 -0
- mbira_dzavadzimu.jpg +0 -0
- mbira_matepe.jpg +0 -0
- mbira_nyunga_nyunga.jpg.webp +0 -0
- requirements.txt +1 -0
Mbira Classifier.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
learn = load_learner('export.pkl')
|
6 |
+
|
7 |
+
categories = learn.dls.vocab
|
8 |
+
|
9 |
+
def classify_image(img):
|
10 |
+
pred,idx,probs = learn.predict(img)
|
11 |
+
return dict(zip(categories, map(float,probs)))
|
12 |
+
|
13 |
+
image = gr.components.Image(shape=(192, 192))
|
14 |
+
label = gr.components.Label()
|
15 |
+
examples = ['mbira_dzavadzimu.jpg', 'mbira_matepe.jpg', 'mbira_nyunga_nyunga.jpg.webp']
|
16 |
+
|
17 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
18 |
+
intf.launch(inline=False)
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ecd541f7875e37f2b38aefa644a9d308f64997811934abeccf913069532e35c6
|
3 |
+
size 46969487
|
mbira_dzavadzimu.jpg
ADDED
mbira_matepe.jpg
ADDED
mbira_nyunga_nyunga.jpg.webp
ADDED
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|