File size: 1,177 Bytes
bf566c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2afe656
 
bf566c5
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
# set path
import glob, os, sys; 
sys.path.append('../utils')

#import needed libraries
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import streamlit as st
from utils.sector_classifier import load_sectorClassifier, sector_classification
import logging
logger = logging.getLogger(__name__)
from utils.config import get_classifier_params
from utils.preprocessing import paraLengthCheck
from io import BytesIO
import xlsxwriter
import plotly.express as px


# Declare all the necessary variables
classifier_identifier = 'sector'
params  = get_classifier_params(classifier_identifier)

def app():

    ### Main app code ###
    with st.container():
                
        if 'key1' in st.session_state:
            df = st.session_state.key1
            classifier = load_sectorClassifier(classifier_name=params['model_name'])
            st.session_state['{}_classifier'.format(classifier_identifier)] = classifier
                
            df = sector_classification(haystack_doc=df,
                                        threshold= params['threshold'])

            st.dataframe(df)

            st.session_state.key1 = df