Spaces:
Sleeping
Sleeping
import streamlit as st | |
from transformers import pipeline | |
from PIL import Image | |
# Load the pre-trained fast food classifier model from Hugging Face | |
classifier = pipeline(task="image-classification", model="AryanKaushik/fastfood-classifier") | |
st.title("π Fast Food Classifier") | |
st.write("Upload an image and find out if it's a burger, pizza, cupcake, fries, or waffle!") | |
# Upload an image | |
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"]) | |
if uploaded_file is not None: | |
col1, col2 = st.columns(2) | |
# Show the image | |
image = Image.open(uploaded_file) | |
col1.image(image, caption="Uploaded Image", use_container_width=True) | |
# Run prediction | |
predictions = classifier(image) | |
# Show results | |
col2.header("Prediction Results") | |
for p in predictions: | |
col2.subheader(f"{p['label']}: {round(p['score'] * 100, 2)}%") | |