NLP_app / app_models /bag_of_words_MODEL.py
Awlly's picture
first
a15e210
raw
history blame
553 Bytes
import streamlit as st
import joblib
from preprocessing import data_preprocessing
# Load your trained BoW model and vectorizer
vectorizer_path = 'model_data/bow_vectorizer.joblib'
model_path = 'model_data/bow_model.joblib'
vectorizer = joblib.load(vectorizer_path)
model = joblib.load(model_path)
# Streamlit UI
def predict(input):
processed_text = data_preprocessing(input)
user_input_bow = vectorizer.transform([processed_text])
# Make a prediction
prediction = model.predict(user_input_bow)
return prediction
# User text input