Spaces:
Sleeping
Sleeping
| import sys | |
| import os | |
| import streamlit as st | |
| from PIL import Image | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) | |
| from predict import predict | |
| st.set_page_config(page_title="Cat Breed Classifier") | |
| st.title("🐱 Cat Breed Image Classifier") | |
| st.write("Upload a cat image and the model will predict its breed.") | |
| uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"]) | |
| if uploaded_file is not None: | |
| image = Image.open(uploaded_file).convert("RGB") | |
| st.image(image, caption="Uploaded Image", use_container_width=True) | |
| with open("temp_image.jpg", "wb") as f: | |
| f.write(uploaded_file.getbuffer()) | |
| st.write("Predicting...") | |
| label = predict("temp_image.jpg") | |
| st.success(f"Predicted Cat Breed: **{label}**") | |