matikosowy commited on
Commit
b8335da
·
verified ·
1 Parent(s): dfee527

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ learn = load_learner('car-model.pkl')
5
+ categories = ['Porsche', 'Mercedes', 'Other']
6
+
7
+ def classify_image(img):
8
+ pred, idx, probs = learn.predict(img)
9
+ return dict(zip(categories, map(float, probs)))
10
+
11
+ image = gr.inputs.Image(shape=(224, 224))
12
+ label = gr.outputs.Label()
13
+
14
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
15
+ intf.launch(inline=False)