CoolFace
Apppublic

abdulrafishaik/Sentimental_Analysis_using_pretrained_models

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
app.py27 linesDownload Raw Back to root
1from transformers import pipeline2import gradio as gr3 4# Label mapping5human_read = {"LABEL_0": "Negative", "LABEL_1": "Positive"}6 7# Load model8sentimental = pipeline("text-classification", model="Dmyadav2001/Sentimental-Analysis")9 10# Prediction function11def predictive_model(texts):12    result = sentimental(texts)13    sentiment = human_read[result[0]["label"]]14    score = result[0]["score"]15    return sentiment, score16 17# Gradio Interface18interface = gr.Interface(19    fn=predictive_model,20    inputs="text",21    outputs=["text", "number"],22    title="Sentiment-Analysis-App",23    description="Give your text, and my model will predict whether it's Positive or Negative."24)25 26interface.launch()27