File size: 1,670 Bytes
f46ca7d
70ef5dd
f46ca7d
 
 
8f05c27
f46ca7d
 
 
 
 
 
 
 
 
5cdd033
128069b
1e3d57c
4f9a775
 
 
 
128069b
4f9a775
 
b0e0334
f46ca7d
 
 
 
0c475de
128069b
f46ca7d
0d88129
29c5a01
 
ab554c1
4f9a775
128069b
29c5a01
4f9a775
128069b
0c475de
d08d63d
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
'''
Achmad Dhani

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.subheader("Can you describe what you're going through right now ?")
    user_input = st.text_input(
        label='Express yourself here ↓',
        value='Today, I feel...',
        max_chars=300,
        key='text_input_key',
        placeholder='Please Type here...',
        disabled=False,
        help='Try not to think, and let your heart speak'
)
    st.write('')

    st.write('You entered:', user_input)

    # button
    if st.button(label='Identify Your Feelings'):
        url = "https://remediindonesia.com"
        X= preprocess_text(user_input)
        result= prediction([X])
        st.write(result[1])
        if result[0] == 0:
            st.write("It's alright, you'll do just fine!")
            st.write("If ever you need help on dealing with this, EFT method could certainly help ↓")
            st.markdown(f'<a href="{url}" target="_blank">You can learn more about EFT here with Rumah Remedi</a>', unsafe_allow_html=True)
        elif result[0] == 1:
            st.write("It's alright to be angry. We believe you'll get through it eventually! If you need help calming down, we would suggest the link below ↓")
            st.markdown(f'<a href="{url}" target="_blank">You could destress with Rumah Remedi</a>', unsafe_allow_html=True)
        else:
            st.write("That's Great! We hope the rest of the day will be as wonderful!")