File size: 493 Bytes
73a73f3
 
eca4248
 
73a73f3
 
72c609a
 
287d769
73a73f3
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pickle
import gradio as gr
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import BernoulliNB


with open('stress_1.0.pkl','rb') as f:
    model = pickle.load(f)
    #print(model.steps)

def predict_stress(text):
  return model.predict([text])[0].upper()


demo = gr.Interface(
    fn = predict_stress,
    inputs=gr.Textbox(lines=2, placeholder="Enter Text Here...", label = 'Predicting Stress through text'),
    outputs = 'text',
)

demo.launch()