sevvaliclal's picture
Update src/app.py
2f6175f verified
Raw
History Blame Contribute Delete
819 Bytes
import streamlit as st
import numpy as np
import tensorflow as tf
from PIL import Image
# Load model
model = tf.keras.models.load_model("src/street_food_model.keras")
class_names = [
'burger','churros','crepes','falafel',
'hot_dog','pad_thai','pani_puri',
'pretzel','shawarma','tacos'
]
st.title("🍔 Street Food Classifier")
uploaded_file = st.file_uploader("Upload an image", type=["jpg","png","jpeg"])
if uploaded_file is not None:
image = Image.open(uploaded_file).resize((224,224))
st.image(image, caption="Uploaded Image", use_column_width=True)
img_array = np.array(image) / 255.0
img_array = np.expand_dims(img_array, axis=0)
prediction = model.predict(img_array)
predicted_class = class_names[np.argmax(prediction)]
st.success(f"Prediction: {predicted_class}")