File size: 989 Bytes
3a7d137
 
 
290e20b
994ba2a
290e20b
 
 
 
 
 
 
 
 
 
 
 
3a7d137
 
 
 
 
 
 
 
 
 
 
 
 
 
290e20b
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
33
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)])