import gradio as gr from transformers import pipeline model_name = "distilbert/distilbert-base-uncased-finetuned-sst-2-english" sentiment_analysis = pipeline("text-classification", model=model_name) def pipe(text): return "The entered sentence is: " + str(sentiment_analysis (text)[0]["label"])+ "!" demo = gr.Interface( fn=pipe, inputs=["text"], outputs=["text"], ) demo.launch()