Spaces:
Sleeping
Sleeping
| ''' | |
| 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!") | |