johannezz commited on
Commit
6b70c57
·
1 Parent(s): 950c378

app and imgs

Browse files
Files changed (4) hide show
  1. app.py +24 -0
  2. hindu.jpg +0 -0
  3. norse.jpg +0 -0
  4. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from fastai.vision.all import *
3
+ import skimage
4
+ import gradio as gr
5
+
6
+ learn = load_learner("god-model.pkl")
7
+
8
+ labels = learn.dls.vocab
9
+ def predict(img):
10
+ img = PILImage.create(img)
11
+ pred,pred_idx,probs = learn.predict(img)
12
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
13
+
14
+ title = "God Classifier"
15
+ description = "A Norse/Hindu God Classifier (fastai course exercise)"
16
+
17
+ gr.Interface(fn=predict,
18
+ inputs=gr.inputs.Image(shape=(512, 512)),
19
+ outputs=gr.outputs.Label(num_top_classes=2),
20
+ title=title,
21
+ description=description,
22
+ examples=['hindu.jpg','norse.jpg'],
23
+ interpretation='default',
24
+ enable_queue=True).launch(share=True)
hindu.jpg ADDED
norse.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image