Patters commited on
Commit
0fec983
1 Parent(s): 760a3ca
Files changed (2) hide show
  1. app.py +27 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ learn = load_learner("model.pkl")
5
+
6
+ categories = ["Lala", "02"]
7
+
8
+
9
+ def classify_img(img):
10
+ pred, idx, probs = learn.predict(img)
11
+ return dict(zip(categories, map(float, probs)))
12
+
13
+
14
+ image = gr.inputs.Image(shape=(128, 128))
15
+ label = gr.outputs.Label()
16
+ examples = ["lala.png", "02.jpg"]
17
+
18
+ title = "02 or lala classifier"
19
+
20
+ iface = gr.Interface(
21
+ fn=classify_img,
22
+ inputs=image,
23
+ outputs=label,
24
+ examples=examples,
25
+ title=title,
26
+ )
27
+ iface.launch(inline=False)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai