harishb00 commited on
Commit
a957126
1 Parent(s): cee3e49
Files changed (4) hide show
  1. app.py +26 -0
  2. model.pkl +3 -0
  3. mon2.jpg +0 -0
  4. picas.jpg +0 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import platform
2
+ from fastai.vision.all import *
3
+ import gradio as gr
4
+
5
+
6
+ if platform.system() == 'Windows':
7
+ import pathlib
8
+ pathlib.PosixPath = pathlib.WindowsPath
9
+
10
+ learn = load_learner('model.pkl')
11
+ labels = learn.dls.vocab
12
+
13
+ def predict(img):
14
+ img = PILImage.create(img)
15
+ pred,pred_idx,probs = learn.predict(img)
16
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
17
+
18
+ title = "Painting Classifier"
19
+ description = "A painting classifier trained to classify Picasso and Monet paintings using dataset scrapped from Duck Duck Go Image search."
20
+ demo = gr.Interface(fn=predict,
21
+ inputs=gr.Image(height=400),
22
+ outputs="label",
23
+ examples=["picas.jpg", "mon2.jpg"],
24
+ title=title,
25
+ description=description,)
26
+ demo.launch()
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5386adabdc43d11a0b01f2b5590aad867acf18dd71b179d835b4c3edd0a071b9
3
+ size 46959550
mon2.jpg ADDED
picas.jpg ADDED