Spaces:
Sleeping
Sleeping
File size: 932 Bytes
5514c44 |
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 |
import streamlit as st
import pandas as pd
from io import StringIO
from fastai import *
from fastai.vision.all import *
import bz2file as bz2
import pickle
header = st.container()
inference = st.container()
with header:
st.title("Cuisine Classifier")
st.text("Is your food Italian, French, Chinese, Indian, or Japanese?")
with inference:
learn_inf = load_learner('export.pkl')
st.header('Show me your food pic!')
st.text("(I currently accept Italian, French, Chinese, Indian, or Japanese. Otherwise, I guesss wildly!)")
uploaded_file = st.file_uploader("Show me your food pic!")
if uploaded_file is not None:
img = load_image(uploaded_file)
pred, pred_idx, probs = learn_inf.predict(img)
prob_value = probs[pred_idx].item()
rounded_prob_percentage = round(prob_value * 100)
st.text(f"This is {pred}, isn't it? Believe me, I am {rounded_prob_percentage}% sure!") |