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()