File size: 748 Bytes
4c64d64
a07083f
 
 
 
 
 
 
 
50a8396
 
231b5e3
a07083f
88fc88b
21d4113
7d41901
21d4113
69e2ec6
7605ebd
 
48c865b
0a245e5
48c865b
a6222a0
 
2bdf603
a6222a0
 
 
 
 
3ab4575
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
28
29
30
31
32
import gradio as gr
import pickle
import matplotlib.pyplot as plt
import numpy as np
import os
import PIL
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from keras.models import load_model

img_height,img_width=180,180



model_flower = keras.models.load_model('model_flower.h5')

class_names = ['daisy', 'dandelion', 'roses', 'sunflowers', 'tulips']





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

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

gr.Interface(fn=predict_image, inputs=image, outputs=label,interpretation='default').launch()