Spaces:
Runtime error
Runtime error
import streamlit as st | |
from fastai.vision.all import * | |
st.set_page_config( | |
page_title="IG PIC?", | |
menu_items={ | |
'About': "# Help decide whether I can use this picture on Instagram or not using face attractiveness measure ;)" | |
} | |
) | |
st.title('Can I use it as an Instagram Picture?') | |
st.header('Upload your IG Picture') | |
uploaded_file = st.file_uploader("Upload your image", type=["jpg","png","jpeg"], help = "Upload single jpg or png image") | |
learner = load_learner("model_1.pkl") | |
if uploaded_file is not None: | |
image = PILImage.create(uploaded_file) | |
col1, col2 = st.columns(2) | |
col1.image(image) | |
attractive,id, probs = learner.predict(image) | |
id = int(id) | |
probs = np.array(probs) | |
if id == 0: | |
col2.subheader('Instagram Picture') | |
col2.metric(label="", value= int(probs[0] * 100), delta="+") | |
else: | |
col2.subheader('Not an Instagram Picture') | |
col2.metric(label="", value=int(probs[1] * 100), delta="-") | |