Spaces:
No application file
No application file
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,42 +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 |
-
details = [
|
| 21 |
-
["NAME: OLUMIDE TOLULOPE SAMUEL,"],
|
| 22 |
-
["MATRIC NO: HNDCOM/22/037"],
|
| 23 |
-
["CLASS: HND1"],
|
| 24 |
-
["LEVEL: 300L"],
|
| 25 |
-
["DEPARTMENT: COMPUTER SCIENCE"],
|
| 26 |
-
]
|
| 27 |
-
|
| 28 |
-
article = """<h4 style='text-align: center'><b>NAME: OLUMIDE TOLULOPE SAMUEL</b> </br> <b>MATRIC NO: HNDCOM/22/037</b> </br> <b>CLASS: HND1</b> </br> <b>LEVEL: 300L</b> </br> <b>DEPARTMENT: COMPUTER SCIENCE</b> </h4>
|
| 29 |
-
<h4> Model Training and </h4>
|
| 30 |
-
<div></br>
|
| 31 |
-
<b>Image Preprocessing and Testing</b>
|
| 32 |
-
<p>Preprocessing for Daisy flowers</p>
|
| 33 |
-
<img src="https://huggingface.co/spaces/miracle01/Flower_Classification/blob/main/output_daisy.png" alt="daisy flower" width="500" height="600">
|
| 34 |
-
</div>
|
| 35 |
-
"""
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
gr.Interface(fn=predict_image, inputs=image, outputs=label,
|
| 39 |
-
title="Flower Classification using InceptionV3",
|
| 40 |
-
description="A flower classification app built using python and deployed using gradio/n" + "NAME: OLUMIDE TOLULOPE SAMUEL",
|
| 41 |
-
article=article,
|
| 42 |
-
interpretation='default').launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|