Spaces:
Sleeping
Sleeping
File size: 1,465 Bytes
f46ca7d 8f05c27 f46ca7d da62426 8f05c27 f46ca7d 0c475de f46ca7d 0d88129 29c5a01 0c475de 29c5a01 0c475de | 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | '''
Phase 2 Graded Challenge 1
Nama : Achmad Dhani
Batch : HCK-009
Objective : Creating a page for emotion classification
'''
from functions import preprocess_text, prediction
import streamlit as st
import pandas as pd
import joblib
from PIL import Image
def run():
'''
This function is for running the page for predictions
'''
st.title('What are you feeling right now ?')
user_input = st.text_input(label='Please type what you feel',
value='Today, i feel...',
max_chars=50,
key='text_input_key',
type='default',
help='Try not to think, and let your heart speak',
autocomplete=None,
on_change=None,
args=None,
kwargs=None,
placeholder='Please Type here...',
disabled=False,
label_visibility='visible')
st.write('You entered:', user_input)
# button
if st.button(label='Identify Your Feelings'):
X= preprocess_text(user_input)
result= prediction([X])
st.write(result[1])
if result[0] == 0:
st.write("Don't worry, you'll be fine")
elif result[0] == 1:
st.write('Calm down bro')
else:
st.write("That's Great!")
|