ppsingh commited on
Commit
bf566c5
1 Parent(s): fde6f03

Create sector.py

Browse files
Files changed (1) hide show
  1. appStore/sector.py +38 -0
appStore/sector.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # set path
2
+ import glob, os, sys;
3
+ sys.path.append('../utils')
4
+
5
+ #import needed libraries
6
+ import seaborn as sns
7
+ import matplotlib.pyplot as plt
8
+ import numpy as np
9
+ import pandas as pd
10
+ import streamlit as st
11
+ from utils.sector_classifier import load_sectorClassifier, sector_classification
12
+ import logging
13
+ logger = logging.getLogger(__name__)
14
+ from utils.config import get_classifier_params
15
+ from utils.preprocessing import paraLengthCheck
16
+ from io import BytesIO
17
+ import xlsxwriter
18
+ import plotly.express as px
19
+
20
+
21
+ # Declare all the necessary variables
22
+ classifier_identifier = 'sector'
23
+ params = get_classifier_params(classifier_identifier)
24
+
25
+ def app():
26
+
27
+ ### Main app code ###
28
+ with st.container():
29
+
30
+ if 'key1' in st.session_state:
31
+ df = st.session_state.key1
32
+ classifier = load_sectorClassifier(classifier_name=params['model_name'])
33
+ st.session_state['{}_classifier'.format(classifier_identifier)] = classifier
34
+
35
+ df = sector_classification(haystack_doc=df,
36
+ threshold= params['threshold'])
37
+
38
+ st.session_state.key1 = df