Spaces:
Sleeping
Sleeping
Gowtham M
commited on
Commit
•
5e8b157
1
Parent(s):
76616f1
Add application file
Browse files- app.py +11 -4
- export.pkl +3 -0
app.py
CHANGED
@@ -1,7 +1,14 @@
|
|
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
+
learn = load_learner('export.pkl')
|
4 |
|
5 |
+
actors = learn.dls.vocab
|
6 |
+
def classify_images(img):
|
7 |
+
pred, idx, prob = learn.predict(img)
|
8 |
+
return dict(zip(actors, map(float, prob)))
|
9 |
|
10 |
+
image = gr.Image(height=192, width= 192)
|
11 |
+
label = gr.Label()
|
12 |
+
examples = ['rajini.jpg', 'vijay.jpg']
|
13 |
+
intf = gr.Interface(fn = classify_images, inputs = image, outputs=label, examples=examples)
|
14 |
+
intf.launch(inline=False)
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bf5e71d90d2549ccf74395d9acf6e3018231a79ed4839b80786781750ee8f1cd
|
3 |
+
size 61146133
|