File size: 983 Bytes
9ceae55
69070dc
9ceae55
69070dc
 
 
 
 
 
 
 
9ceae55
69070dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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="-")