Laurits commited on
Commit
e345bbb
·
1 Parent(s): abdee9b

Create app

Browse files
Files changed (5) hide show
  1. app.py +12 -4
  2. emma_watson.jpg +0 -0
  3. model.pth +3 -0
  4. test.ipynb +0 -0
  5. tom_hanks.jpeg +0 -0
app.py CHANGED
@@ -1,7 +1,15 @@
 
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
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
4
+ learn = load_learner('model.pth')
 
5
 
6
+ def classify_image(img):
7
+ name, prob = celebrity_name,_,probs = learn.predict(img)
8
+ return {name: prob}
9
+
10
+ image = gr.inputs.Image(shape=(224,224))
11
+ label = gr.outputs.Label()
12
+ examples = ['emma_watson.jpeg', "tom_hanks.jpeg"]
13
+
14
+ iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
15
+ iface.launch(inline=False)
emma_watson.jpg ADDED
model.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:340038e160647e3192892928b16fb365e6516bb87938d4ccacb14f8738170a20
3
+ size 47342937
test.ipynb ADDED
File without changes
tom_hanks.jpeg ADDED