File size: 1,220 Bytes
f46ca7d
 
 
 
 
 
 
 
 
092ef5d
f46ca7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
'''
Phase 2 Graded Challenge 1

Nama : Achmad Dhani

Batch : HCK-009

Objective : Creating a page for emotion classification
'''
from functions import get_wordnet_pos, 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='Enter some text', 
                           value='default text', 
                           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='Predict'):
        X= preprocess_text(user_input)
        prediction([X])