Spaces:
Runtime error
Runtime error
| 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) |