Delete app.py
Browse files
app.py
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
|
2 |
-
import tensorflow
|
3 |
-
from tensorflow import keras
|
4 |
-
from keras.models import load_model
|
5 |
-
model1 = load_model("inception.h5")
|
6 |
-
|
7 |
-
img_width, img_height = 180, 180
|
8 |
-
class_names = ['daisy', 'dandelion', 'roses', 'sunflowers', 'tulips']
|
9 |
-
num_classes = len(class_names)
|
10 |
-
|
11 |
-
def predict_image(img):
|
12 |
-
img_4d = img.reshape(-1, img_width, img_height, 3) # 4D coz model trained on multiple 3Ds
|
13 |
-
prediction = model1.predict(img_4d)[0]
|
14 |
-
return {class_names[i]: float(prediction[i]) for i in range(num_classes)}
|
15 |
-
|
16 |
-
|
17 |
-
import gradio as gr
|
18 |
-
image = gr.inputs.Image(shape=(img_height, img_width))
|
19 |
-
label = gr.outputs.Label(num_top_classes=num_classes)
|
20 |
-
|
21 |
-
gr.Interface(fn=predict_image, inputs=image, outputs=label, title="Flower Classification using InceptionV3", interpretation='default').launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|