alperenunlu commited on
Commit
5ce4ab5
1 Parent(s): b7dc3f6

Init commit

Browse files
Files changed (5) hide show
  1. British_Shorthair.jpg +0 -0
  2. Ragdoll.jpg +0 -0
  3. Shiba_inu.jpg +0 -0
  4. app.py +23 -0
  5. pets.pkl +3 -0
British_Shorthair.jpg ADDED
Ragdoll.jpg ADDED
Shiba_inu.jpg ADDED
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner("pets.pkl")
5
+ categories = learn.vocab
6
+
7
+
8
+ def classify_image(img):
9
+ pred, idx, probs = learn.predict(img)
10
+ return dict(zip(categories, map(float, probs)))
11
+
12
+
13
+ image = gr.Image()
14
+ label = gr.Label(num_top_classes=5)
15
+ examples = [
16
+ "Ragdoll.jpg",
17
+ "Shiba_inu.jpg",
18
+ "British_Shorthair.jpg",
19
+ ]
20
+
21
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
22
+
23
+ intf.launch()
pets.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8011b96bc737fa4b6876a4104a11ae89550a5e908e78162271b1c664165d38dd
3
+ size 102826302