Spaces:
Runtime error
Runtime error
import joblib | |
import gradio as gr | |
model = joblib.load("model.pkl") | |
def get_sentiment(input_text): | |
predictions = model.predict_proba([input_text]) | |
label = { | |
"negative":str(predictions[0][0]), | |
"positive":str(predictions[0][1]), | |
} | |
return label | |
iface = gr.Interface( | |
fn=get_sentiment, | |
inputs=[gr.Text(text="Sijapendezwa na tabia yake")], | |
outputs=[gr.Label(label='Sentiment')], | |
title="Swahili Sentiment Analysis using", | |
description="Swahili sentiment analysis is based on a Bayesian scikit-learn model" | |
) | |
iface.launch(inline=False) | |