File size: 1,161 Bytes
f8f4b5f
 
 
 
 
 
 
 
 
 
 
05c7436
4a7c4bb
 
 
 
f8f4b5f
9e29b10
 
 
 
f8f4b5f
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import joblib # Load Joblib file
import json # Load JSON file
from sklearn.feature_extraction.text import CountVectorizer # Convert text to BOW format
from flask import Flask, request, jsonify # Flask Server
from tensorflow.keras.preprocessing.text import Tokenizer # tokenizing text documents into sequences of tokens (Seq Model)
from tensorflow.keras.preprocessing.sequence import pad_sequences # ensure that all sequences in a dataset have the same length (Seq Model)
from tensorflow.keras.models import load_model # load a pre-trained Keras model saved in the Hierarchical Data Format (HDF5) file format
import numpy as np # scientific computing in Python
import streamlit as st

# load all the models and vectorizer (global vocabulary)
# Seq_model = load_model('./LSTM.h5') # Sequential
SVM_Linear_model = joblib.load("SVM_Linear_Model.joblib") # SVM
logistic_model = joblib.load("Logistic_Model.joblib") # Logistic
vectorizer = joblib.load('vectorizer.joblib') # global vocabulary
tokenizer = joblib.load('tokenizer.joblib')

# Test
x = st.slider('Select a value')
st.write(x, 'squared is', x * x)

if url:
    result = categorize(url)
    st.json(result)