File size: 553 Bytes
a15e210
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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