Spaces:
Sleeping
Sleeping
RyuMoro
commited on
Commit
•
9f24d9b
1
Parent(s):
2215494
First commit
Browse files- export.pkl +3 -0
- main.py +28 -0
- requirements.txt +4 -0
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:662f8073409cebfeb01d4b79f16aab8afa5a99371a7cb8602c13a8fcfe3536f2
|
3 |
+
size 114626320
|
main.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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!")
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
bz2file==0.98
|
2 |
+
fastai==2.7.14
|
3 |
+
pandas==2.2.2
|
4 |
+
streamlit==1.33.0
|