Spaces:
Runtime error
Runtime error
Bimurat Mukhtar
commited on
Commit
·
fbcf0aa
1
Parent(s):
a0a0e81
added model
Browse files- app.py +9 -4
- model_upd.pkl +3 -0
app.py
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
from fastai.learner import *
|
4 |
|
5 |
+
learn = load_learner('model_upd.pkl')
|
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 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
|
model_upd.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7d11a813b77f78a2534203e9f9b0301a43993d9eecdb0e25aa87ff2067f80815
|
3 |
+
size 46957849
|