File size: 820 Bytes
72e9a58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import tensorflow as tf
import numpy as np
from PIL import Image
import tensorflow.keras as keras
import keras.applications.vgg16 as vgg16

from tensorflow.keras.models import load_model

model=load_model("model1.h5")

classnames=["Fire","Non-Fire"]

def predict_image(img):
    img_4d=img.reshape(-1,180,180,3)
    prediction=model.predict(img_4d)[0]
    return {classname[i]: float(prediction[i] for i in range(5))}

image=gr.inputs.Image(shape=(180,180))
label=gr.outputs.Label(num_top_classes=2)    

artice="<p style='text-align: center'>Made by Mahak xoxo</p>"


gr.Interface(fn=predict_img,inputs=image,title="Forest Fire Classifier",description="THis is a forest fire classification model ",outputs=label,article=article,enable_queue=enable_queue,interpretation='default').launch(share=True)