File size: 644 Bytes
f62a90d 91ad070 f62a90d 13f8a60 f62a90d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import sklearn
import gradio as gr
import joblib
pipe = joblib.load("./pipeline.pkl")
inputs = [gr.Textbox(value = "I love this!")]
outputs = [gr.Label(label = "Sentiment")]
title = "Sentiment Analysis Classifier"
description = "This is a sentiment classifier using longformer model with a logistic regression head. "
def infer(inputs):
predictions = pipe.predict_proba([inputs])
label = {
"negative":str(predictions[0][0]),
"positive":str(predictions[0][1]),
}
return label
gr.Interface(infer, inputs = inputs, outputs = outputs, title = title, description = description).launch() |