Spaces:
Runtime error
Runtime error
Create app
Browse files- app.py +12 -4
- emma_watson.jpg +0 -0
- model.pth +3 -0
- test.ipynb +0 -0
- tom_hanks.jpeg +0 -0
app.py
CHANGED
@@ -1,7 +1,15 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
![]() |