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()