Addai commited on
Commit
f2c8f7f
1 Parent(s): 7cb85de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+
5
+ learn = load_learner('export.pkl')
6
+
7
+ labels = learn.dls.vocab
8
+ def predict(img):
9
+ img = PILImage.create(img)
10
+ pred,pred_idx,probs = learn.predict(img)
11
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
+
13
+ title = "Fosgaxy galaxy classifier"
14
+ description = "<p style='text-align: center'><b>As far as human civilization and space travel is concerned, you may want to know types of Galaxies in this universe. We are trying to classifier three types of galaxies here.<b><p>"
15
+ article="<p style='text-align: center'> WE have the Spiral galaxy, elliptical galaxy, Peculiar galaxy and Irregular galaxy. Upload your galaxy for correct classification<b></p>"
16
+ examples = ['ffff.jpg']
17
+ #interpretation='default'
18
+ enable_queue=True
19
+
20
+ gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,enable_queue=enable_queue).launch()