File size: 1,287 Bytes
3148b97 |
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 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import time
import streamlit as st
from PIL import Image, ImageOps
from src import big_cat_classifier
def main():
st.set_page_config(
page_title="Big Cat Classifier",
layout="centered",
initial_sidebar_state="collapsed",
)
banner_img = Image.open("./assets/banner_img.png")
st.image(banner_img)
st.title("Coded with β€οΈ by Smaranjit Ghose")
st.text("")
st.text("")
st.text("")
uploaded_file = st.file_uploader("Choose an image..", type=["jpg", "png", "jpeg"])
if st.button("Predict"):
if uploaded_file is not None:
try:
img = Image.open(uploaded_file)
st.subheader("Your Image:")
st.image(img)
st.write("")
st.write("")
with st.spinner("Our AI forest officer has started analyzing...."):
label = big_cat_classifier.classifier(uploaded_file)
time.sleep(5)
st.success(f"We think this is an image of a {label}")
except:
st.error("We apologize something went wrong ππ½ββοΈ")
else:
st.error("Can you please upload an image ππ½ββοΈ")
if __name__ == "__main__":
main()
|