Boiler plate 0.1
Browse files- .gitignore +1 -0
- app.py +13 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.venv/
|
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
|
3 |
+
learn = load_learner('export.pkl')
|
4 |
+
labels = learn.dls.vocab
|
5 |
+
def predict(img):
|
6 |
+
img = PILImage.create(img)
|
7 |
+
pred,pred_idx,probs = learn.predict(img)
|
8 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
9 |
+
|
10 |
+
import gradio as gr
|
11 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)),
|
12 |
+
outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
13 |
+
|