curtpond commited on
Commit
2aa7ddb
1 Parent(s): 9c3960f

Updated app.py.

Browse files
Files changed (1) hide show
  1. app.py +7 -3
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('lg_classifier.sav', 'rb'))
8
 
9
- # Define function to predict label
10
  def predict(text):
11
- return model.predict([[text]])[0]
 
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,