MarcusAGray commited on
Commit
8c74959
·
1 Parent(s): 3736957

Add application file

Browse files
Files changed (6) hide show
  1. app.py +17 -0
  2. black_widow.jpg +0 -0
  3. hulk.jpg +0 -0
  4. iron_man.jfif +0 -0
  5. model.pkl +3 -0
  6. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fast.ai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner('model.pkl')
5
+
6
+ categories = ('Black Widow','Captain America' 'Hawkeye', 'Hulk', 'Iron man', 'Thor')
7
+
8
+ def classify_image(img):
9
+ pred,idx,probs = learn.predict(img)
10
+ return dict(zip(categories, map(float, probs)))
11
+
12
+ image = gr.inputs.Image(shape=(192, 192))
13
+ label = gr.outputs.Label()
14
+ examples = ['black_widow.jpg', 'hulk.jpg', 'iron_man.jfif']
15
+
16
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
17
+ intf.launch(inline=False)
black_widow.jpg ADDED
hulk.jpg ADDED
iron_man.jfif ADDED
Binary file (8.12 kB). View file
 
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:daf71057c879f1c3860ff71c11c1b78ebd20a51b2c79fa338d44b3a106dab2d3
3
+ size 46995809
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai