|
import tensorflow as tf |
|
model=tf.keras.models.load_model('model.h5') |
|
import streamlit as st |
|
st.header("Wonderful Wonders Classification") |
|
st.markdown("This model takes in the image input of any wonder of the world and tries to classify it.") |
|
categories=['Roman Colosseum', |
|
'Stonehenge', |
|
'Machu Pichu', |
|
'Chichen Itza', |
|
'Christ The Reedemer', |
|
'Eiffel Tower', |
|
'Taj Mahal', |
|
'Pyramids Of Giza', |
|
'Statue of Liberty', |
|
'Burj Khalifa', |
|
'Venezuela Angel Falls', |
|
'Great Wall of China'] |
|
from PIL import Image |
|
uploaded_image=st.file_uploader("Upload image",type=["jpg","jpeg","webp"]) |
|
import numpy as np |
|
import cv2 |
|
if(uploaded_image!=None): |
|
display_image=Image.open(uploaded_image) |
|
st.image(display_image,width=200) |
|
if st.button("Predict"): |
|
img = np.array(display_image) |
|
img=cv2.resize(img,(150,150)) |
|
img=img/255.0 |
|
img=img.reshape(1,150,150,3) |
|
pred=model.predict(img) |
|
print(pred[0][0]) |
|
st.text(categories[np.argmax(pred)]) |
|
|