Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,13 +3,14 @@ import numpy as np
|
|
| 3 |
import pickle
|
| 4 |
import streamlit.components.v1 as components
|
| 5 |
from sklearn.feature_extraction.text import CountVectorizer
|
| 6 |
-
|
| 7 |
# Load the pickled model
|
| 8 |
def load_model():
|
| 9 |
return pickle.load(open('Sarcasm_Detection_BernoulliNB.pkl', 'rb')) #Load model from notebook
|
| 10 |
|
| 11 |
# Function for model prediction
|
| 12 |
def model_prediction(model, features):
|
|
|
|
| 13 |
features = cv.transform([features]).toarray()
|
| 14 |
predicted = str(model.predict(features)[0])
|
| 15 |
return predicted
|
|
|
|
| 3 |
import pickle
|
| 4 |
import streamlit.components.v1 as components
|
| 5 |
from sklearn.feature_extraction.text import CountVectorizer
|
| 6 |
+
|
| 7 |
# Load the pickled model
|
| 8 |
def load_model():
|
| 9 |
return pickle.load(open('Sarcasm_Detection_BernoulliNB.pkl', 'rb')) #Load model from notebook
|
| 10 |
|
| 11 |
# Function for model prediction
|
| 12 |
def model_prediction(model, features):
|
| 13 |
+
cv = CountVectorizer()
|
| 14 |
features = cv.transform([features]).toarray()
|
| 15 |
predicted = str(model.predict(features)[0])
|
| 16 |
return predicted
|