Spaces:
Sleeping
Sleeping
Updated app.py.
Browse files
app.py
CHANGED
@@ -3,12 +3,16 @@ import gradio as gr
|
|
3 |
from sklearn.linear_model import LogisticRegression
|
4 |
import pickle5 as pickle
|
5 |
|
|
|
|
|
|
|
6 |
# Load model from pickle file
|
7 |
-
model = pickle.load(open(
|
8 |
|
9 |
-
# Define function to
|
10 |
def predict(text):
|
11 |
-
return model.predict([
|
|
|
12 |
|
13 |
# Define interface
|
14 |
demo = gr.Interface(fn=predict,
|
|
|
3 |
from sklearn.linear_model import LogisticRegression
|
4 |
import pickle5 as pickle
|
5 |
|
6 |
+
# file name
|
7 |
+
lr_filename = 'lg_classifier.sav'
|
8 |
+
|
9 |
# Load model from pickle file
|
10 |
+
model = pickle.load(open(lr_filename, 'rb'))
|
11 |
|
12 |
+
# Define function to make a prediction with the model
|
13 |
def predict(text):
|
14 |
+
return model.predict([text])[0]
|
15 |
+
|
16 |
|
17 |
# Define interface
|
18 |
demo = gr.Interface(fn=predict,
|