Spaces:
Runtime error
Runtime error
File size: 808 Bytes
22b3492 43c9358 eaa8a5b 221ee48 |
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 29 30 |
import streamlit as st
# import pathlib
# temp = pathlib.PosixPath
# pathlib.PosixPath = pathlib.WindowsPath
from fastai import *
from fastai.basics import *
from fastai.callback.all import *
from fastai.vision.all import *
from fastai.vision import *
from fastai.metrics import *
col1, col2 = st.columns([3, 1])
# right column
col1.title('Emotion Detector')
col1.subheader('Let your emotion flow...')
# left column
pic = col2.camera_input('Take a Picture')
if pic:
col2.success('Picture Successfully Uploaded')
col1.text('This is the picture you have taken')
col1.image(pic)
with open ('resource/pic.jpg','wb') as file:
file.write(pic.getbuffer())
learner = load_learner('resource/this.pkl')
result = learner.predict(item='resource/pic.jpg')[0]
col2.text(result) |