Spaces:
Runtime error
Runtime error
AmitPress
commited on
Commit
·
eaa8a5b
1
Parent(s):
22b3492
some advancement
Browse files- app.py +27 -2
- requirements.txt +0 -0
- resource/pic.jpg +0 -0
app.py
CHANGED
|
@@ -1,4 +1,29 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
+
import pathlib
|
| 4 |
+
temp = pathlib.PosixPath
|
| 5 |
+
pathlib.PosixPath = pathlib.WindowsPath
|
| 6 |
+
|
| 7 |
+
from fastai import *
|
| 8 |
+
from fastai.basics import *
|
| 9 |
+
from fastai.callback.all import *
|
| 10 |
+
from fastai.vision.all import *
|
| 11 |
+
from fastai.vision import *
|
| 12 |
+
from fastai.metrics import *
|
| 13 |
+
|
| 14 |
+
col1, col2 = st.columns([3, 1])
|
| 15 |
+
# right column
|
| 16 |
+
col1.title('Emotion Detector')
|
| 17 |
+
col1.subheader('Let your emotion flow...')
|
| 18 |
+
|
| 19 |
+
# left column
|
| 20 |
+
pic = col2.camera_input('Take a Picture')
|
| 21 |
+
if pic:
|
| 22 |
+
col2.success('Picture Successfully Uploaded')
|
| 23 |
+
col1.text('This is the picture you have taken')
|
| 24 |
+
col1.image(pic)
|
| 25 |
+
with open ('resource/pic.jpg','wb') as file:
|
| 26 |
+
file.write(pic.getbuffer())
|
| 27 |
+
|
| 28 |
+
learner = load_learner('resource/this.pkl')
|
| 29 |
+
print(learner.predict(item='resource/pic.jpg'))
|
requirements.txt
ADDED
|
File without changes
|
resource/pic.jpg
ADDED
|