from transformers import pipeline import gradio as gr # Label mapping human_read = {"LABEL_0": "Negative", "LABEL_1": "Positive"} # Load model sentimental = pipeline("text-classification", model="Dmyadav2001/Sentimental-Analysis") # Prediction function def predictive_model(texts): result = sentimental(texts) sentiment = human_read[result[0]["label"]] score = result[0]["score"] return sentiment, score # Gradio Interface interface = gr.Interface( fn=predictive_model, inputs="text", outputs=["text", "number"], title="Sentiment-Analysis-App", description="Give your text, and my model will predict whether it's Positive or Negative." ) interface.launch()