Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +11 -2
src/streamlit_app.py
CHANGED
|
@@ -1,5 +1,14 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
st.title("Tags Predictor!")
|
| 3 |
st.write("Give your context...I will give you its related tags.")
|
| 4 |
-
st.text_input("Enter your Content:")
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import pickle
|
| 3 |
+
import sklearn
|
| 4 |
+
import pandas as pd
|
| 5 |
+
from sklearn.transformers import Pipeline
|
| 6 |
st.title("Tags Predictor!")
|
| 7 |
st.write("Give your context...I will give you its related tags.")
|
| 8 |
+
text = st.text_input("Enter your Content:")
|
| 9 |
+
pre_proc = pickle.load(open("pipeline.pkl",'rb'))
|
| 10 |
+
mlb = pickle.load(open("mlb.pkl",'rb'))
|
| 11 |
+
cleaned = pre_proc.named_steps['pre_processing'].transform(pd.Series([text]))
|
| 12 |
+
vector = pre_proc.named_steps['vectorizer'].transform(cleaned)
|
| 13 |
+
prediction = pre_proc.named_steps['classifier'].predict(vector)
|
| 14 |
+
print(mlb.inverse_transform(prediction))
|