Spaces:
Runtime error
Runtime error
durgaamma2005
commited on
Commit
·
2df9ae4
1
Parent(s):
f57f88a
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
learn = load_learner('howdy_mody.pkl')
|
5 |
+
labels = learn.dls.vocab
|
6 |
+
def predict(img):
|
7 |
+
img = PILImage.create(img)
|
8 |
+
pred,pred_idx,probs = learn.predict(img)
|
9 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
10 |
+
|
11 |
+
title = "Modi, 2014ka, 2021ka"
|
12 |
+
description = "Its fun project to predict whether modi image is from 2014 time period or from 2021, based on his beard size"
|
13 |
+
article="<p style='text-align: center'><a href='https://github.com/mldurga/projects/blob/master/Fire_smoke_detector.ipynb' target='_blank'>Blog post</a></p>"
|
14 |
+
interpretation='default'
|
15 |
+
#examples = ['Neutral2.jpeg','smoke1.jpeg','smoke2.jpeg','fire1.png']
|
16 |
+
|
17 |
+
enable_queue=True
|
18 |
+
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,interpretation=interpretation,enable_queue=enable_queue).launch()
|