Spaces:
Sleeping
Sleeping
delete main.py
Browse files
main.py
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import pandas as pd
|
3 |
-
from io import StringIO
|
4 |
-
from fastai import *
|
5 |
-
from fastai.vision.all import *
|
6 |
-
import bz2file as bz2
|
7 |
-
import pickle
|
8 |
-
|
9 |
-
header = st.container()
|
10 |
-
inference = st.container()
|
11 |
-
|
12 |
-
with header:
|
13 |
-
st.title("Cuisine Classifier")
|
14 |
-
st.text("Is your food Italian, French, Chinese, Indian, or Japanese?")
|
15 |
-
|
16 |
-
with inference:
|
17 |
-
|
18 |
-
learn_inf = load_learner('export.pkl')
|
19 |
-
|
20 |
-
st.header('Show me your food pic!')
|
21 |
-
st.text("(I currently accept Italian, French, Chinese, Indian, or Japanese. Otherwise, I guesss wildly!)")
|
22 |
-
uploaded_file = st.file_uploader("Show me your food pic!")
|
23 |
-
if uploaded_file is not None:
|
24 |
-
img = load_image(uploaded_file)
|
25 |
-
pred, pred_idx, probs = learn_inf.predict(img)
|
26 |
-
prob_value = probs[pred_idx].item()
|
27 |
-
rounded_prob_percentage = round(prob_value * 100)
|
28 |
-
st.text(f"This is {pred}, isn't it? Believe me, I am {rounded_prob_percentage}% sure!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|