File size: 990 Bytes
769af1a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Application entry point, global configuration, application structure"""

from config import app_config
import data
import utils
import tab_about
import tab_ner
import tab_emotions as tab_emotions
import tab_summarization
import streamlit as st


def init():
    ### setup app-wide configuration
    utils.setup_app(app_config)

    ### load data only once and cache it
    nlp = data.load_lang_model(app_config.spacy_lang_model)
    data.load_nltk_punkt()
    df = data.load_emotions_data(app_config.emotions_data_file)

    ### initialize session state

    ### setup app tab structure
    about, ner, summarization, sentiment = utils.create_tabs(
        ["ABOUT πŸ‘‹", "NER & POS πŸ”", "TEXT SUMMARIZATION πŸ“", "TEXT CLASSIFICATION πŸ“‘"]
    )
    with about:
        tab_about.render()
    with ner:
        tab_ner.render(nlp)
    with summarization:
        tab_summarization.render()
    with sentiment:
        tab_emotions.render(df)


if __name__ == "__main__":
    init()