prediction app
Browse files
app.py
CHANGED
|
@@ -1,7 +1,18 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#|export
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
import gradio as gr
|
| 4 |
+
#|export
|
| 5 |
+
learn = load_learner('export.pkl')
|
| 6 |
+
|
| 7 |
+
#|export
|
| 8 |
+
categories = ('Gravel Bike','Mountain Bike','Road Bike')
|
| 9 |
+
|
| 10 |
+
def classify_image(img):
|
| 11 |
+
pred,idx,probs = learn.predict(img)
|
| 12 |
+
return dict(zip(categories,map(float,probs)))
|
| 13 |
+
|
| 14 |
+
#|export
|
| 15 |
+
examples = ['mtb.jpg','road.jpg']
|
| 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:aa58533116012e3585966bdd834512994deefa0829fbd129428cb69bc33e7661
|
| 3 |
+
size 46968225
|
mtb.jpg
ADDED
|
road.jpg
ADDED
|