File size: 949 Bytes
0f16f49 45ed51d d2e23e6 b93df08 d2e23e6 0f16f49 d2e23e6 6257a0b de275c1 6c2a3ec 69956ec d2e23e6 6c2a3ec 4ee0037 d2e23e6 4ee0037 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import gradio as gr
from fastai.vision.all import load_learner
nlearn = load_learner('./Ey.pkl')
categories = ('Chennai', 'London')
def classify_img(img):
pred, idx, prob = nlearn.predict(img)
return dict(zip(categories, map(float, prob)))
def greet(name):
return "Hello " + name + "!!"
# classify_img('/kaggle/input/help-me/Screenshot 2024-02-08 at 23.19.37.png')
image = gr.Image(height=192,width=192)
label = gr.Label()
desc = "This model classifies satellite image of a particular area into possible cities. right now this is trained with Chennai and London city images"
examples = ['./test_data/chennai_1.png', './test_data/chennai_2.png', './test_data/chennai_3.png', './test_data/london_1.png', './test_data/chennai_1.png']
intf = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples, description=desc)
intf.launch()
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
# iface.launch()
|