|
import streamlit as st |
|
import spacy |
|
import pickle |
|
import subprocess |
|
|
|
|
|
st.set_page_config(page_title="Chris Capobianco's Profile", page_icon=':rocket:', layout='wide') |
|
|
|
home = st.Page('Home.py', title = 'Home', default = True) |
|
|
|
|
|
@st.cache_resource |
|
def load_nlp(): |
|
subprocess.run(["python", "-m", "spacy", "download", "en_core_web_sm"]) |
|
return spacy.load('en_core_web_sm') |
|
|
|
def tokenizer(sentence): |
|
|
|
doc = nlp(sentence) |
|
|
|
|
|
|
|
tokens = [ token.lemma_.lower().strip() if token.lemma_ != "-PRON-" else token.lower_ for token in doc ] |
|
|
|
|
|
tokens = [ token for token in tokens if token not in stopwords and token not in punctuations ] |
|
|
|
return tokens |
|
|
|
|
|
@st.cache_resource |
|
def load_tokenizer_model(): |
|
with open('./models/autoclassifier.pkl', 'rb') as model_file: |
|
stopwords = pickle.load(model_file) |
|
punctuations = pickle.load(model_file) |
|
model_pipe = pickle.load(model_file) |
|
return (stopwords, punctuations, model_pipe) |
|
|
|
document_classification = st.Page('projects/01_Document_Classifier.py', title='Document Classifier') |
|
movie_recommendation = st.Page('projects/02_Movie_Recommendation.py', title='Movie Recommendation') |
|
|
|
stock_market = st.Page('projects/05_Stock_Market.py', title='Stock Market Forecast') |
|
generative_music = st.Page('projects/06_Generative_Music.py', title='Generative Music') |
|
llm_fine_tune = st.Page('projects/07_LLM_Fine_Tuned.py', title='Fine Tuned LLM') |
|
|
|
pg = st.navigation( |
|
{ |
|
'Home': [ |
|
home |
|
], |
|
'Projects': [ |
|
document_classification, |
|
movie_recommendation, |
|
|
|
stock_market, |
|
generative_music, |
|
llm_fine_tune |
|
] |
|
} |
|
) |
|
|
|
pg.run() |
|
|
|
|
|
nlp = load_nlp() |
|
|
|
|
|
stopwords, punctuations, model_pipe = load_tokenizer_model() |