import requests import gradio as gr from tensorflow import keras from keras.models import Model from tensorflow.keras import Model #loading the model model1=load_model('model.h5') #providing the labels of our dataset labels = ['rain', 'glaze', 'rime', 'snow', 'fogsmog', 'frost', 'lightning', 'rainbow', 'hail', 'sandstorm', 'dew'] print(labels) #function to classify the image from gc import set_debug def classify_image(inp): inp = inp.reshape((-1, 300, 300, 3)) prediction = model1.predict(inp).flatten() confidences = {labels[i]: float(prediction[i]) for i in range(10)} print(confidences) return confidences #gradio interface to check/test the classification of the images gr.Interface(fn=classify_image, inputs=gr.inputs.Image(shape=(300, 300)), outputs=gr.outputs.Label(num_top_classes=3), examples=["banana.jpg", "car.jpg"]).launch(debug=False)