Lord Walnuts commited on
Commit
ba1042d
1 Parent(s): c26452a

added interface

Browse files
Files changed (5) hide show
  1. app.py +15 -4
  2. art1.jpg +0 -0
  3. john1.jpg +0 -0
  4. peaky.pkl +3 -0
  5. tom1.jpg +0 -0
app.py CHANGED
@@ -1,7 +1,18 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from fastai.vision.all import *
3
 
4
+ learn = load_learner('peaky.pkl')
 
5
 
6
+ categories = ('Thomas Shelby','Arthur Shelby','John Shelby','Michael Gray','Ada Shelby','Polly Gray')
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.inputs.Image(shape=(192,192))
14
+ label = gr.outputs.Label()
15
+ examples = ['art1.jpg','hohn1.jpg','tom1.jpg']
16
+
17
+ intf = gr.Interface(fn=classify_image,inputs=image,outputs=label,examples=examples)
18
+ intf.launch(inline=False)
art1.jpg ADDED
john1.jpg ADDED
peaky.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a68b659343f5edc7b94be1bc006ef6b7712bbfd549006d54c8c0b6295081f79d
3
+ size 102875769
tom1.jpg ADDED