# Imports import gradio as gr from sklearn.linear_model import LogisticRegression # Load model from pickle file model = pickle.load(open('lg_classifier.sav', 'rb')) # Define function to predict def predict(text): return model.predict([text])[0] # Define interface iface = gr.Interface(fn=predict, inputs=gr.inputs.Textbox(lines=10, label="Text"), outputs="text", title="Text Classification", description="Classify text as other[0], healthcare[1], or technology[2]", examples=[ 'As a psychologist, I often hear stories about fighting. After all, conflict is a normal part of any relationship and, during heated conversations, feelings of anger and frustration can swell, causing us to snap at our partners. However, when I hear about people who make threats, resort to name-calling, and yell whenever they get riled up, I get concerned. It’s normal to lose one\'s cool occasionally if you’re arguing with your partner about something, but if these verbal slingshots happen regularly, it may be a sign of emotional abuse. Because the signs may be subtle, discerning between a heated argument and verbal abuse can be tricky.', 'Google welcomed a decision on Monday by London’s High Court to block an attempt to bring legal action over claims it had collected sensitive data from 4 million iPhone users in England and Wales.', 'The U.S. Food and Drug Administration on Monday approved the first drug to treat a rare genetic disorder that causes severe muscle weakness and fatigue, the agency said in a statement.' 'The success of Hudson’s Bay Co Executive Chairman Richard Baker’s $1.3 billion bid to take the department store operator private hinges on whether an independent valuator will view the company more as a retailer and less as a real estate owner, corporate governance experts and analysts said.'], allow_flagging='never' )