mohamedsaeed823's picture
add model.pkl
da3aba1
raw
history blame
383 Bytes
import gradio as gr
from joblib import load
model = load('model.pkl')
def predict_sentiment(text: str)-> str:
sentiment_map = {
-1: 'Negative',
0: 'Neutral',
1: 'Positive'
}
prediction = model.predict([text])[0]
return sentiment_map[prediction]
demo = gr.Interface(fn=predict_sentiment, inputs="text", outputs="text")
demo.launch()