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 do just fine! If ever you need help on dealing with this, EFT method could certainly help.") | |
| url = "https://www.healthline.com/health/eft-tapping#:~:text=Emotional%20freedom%20technique%20(EFT)%20is,as%20tapping%20or%20psychological%20acupressure." | |
| st.markdown(f'<a href="{url}" target="_blank">You can learn more about EFT here!</a>', unsafe_allow_html=True) | |
| elif result[0] == 1: | |
| st.write('Calm down bro') | |
| else: | |
| st.write("That's Great! We hope the rest of the day will be as wonderful!") | |