Spaces:
Sleeping
Sleeping
vaishnavi kamath
commited on
Commit
•
b5e3fc6
1
Parent(s):
f30c166
model implementation
Browse files
ae.png
ADDED
app.py
CHANGED
@@ -1,7 +1,20 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import fastai
|
3 |
+
from fastai.vision.all import *
|
4 |
|
5 |
+
learn_inf = load_learner('export.pkl')
|
6 |
+
|
7 |
+
categories=('Realism','Impressionism','Cubism', 'Baroque', 'Abstract Expressionism')
|
8 |
+
|
9 |
+
def classify_image(img):
|
10 |
+
pred,idx,probs=learn_inf.predict(img)
|
11 |
+
return dict(zip(categories,map(float,probs)))
|
12 |
+
|
13 |
+
|
14 |
+
image=gr.inputs.Image(shape=(192,192))
|
15 |
+
label=gr.outputs.Label()
|
16 |
+
examples=['ae.png']
|
17 |
+
|
18 |
+
intf=gr.Interface(classify_image, image, label, capture_session=True, examples=examples)
|
19 |
+
intf.launch(inline=False)
|
20 |
|
|
|
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cf4764531dab2d6971882d4318d470497be19ef03e8c057c6561cfde89358665
|
3 |
+
size 46972842
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|