git add app.py
Browse filesgit commit -m "Add model.pkl"
git push
app.py
CHANGED
@@ -1,7 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
learn = load_learner('export.pkl')
|
4 |
+
|
5 |
+
labels = learn.dls.vocab
|
6 |
+
def predict(img):
|
7 |
+
img = PILImage.create(img)
|
8 |
+
pred,pred_idx,probs = learn.predict(img)
|
9 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
10 |
+
|
11 |
+
iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
12 |
|
|
|
13 |
iface.launch()
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:00e11deb6d8bd99df524b5b3dcde16c9b5459ef99b65382fa0f4a6e266e6ca50
|
3 |
+
size 47061355
|