#import gradio and transformers pipeline from transformers import pipeline from huggingface_hub import InferenceClient import gradio as gr # the model that we are using sentiment analysis model = pipeline("sentiment-analysis") #the function definetion and the reviews def get_sentiment(input_text): analysis = model(input_text) sent = analysis[0]['label'] score = analysis[0]['score'] return sent, score #interface function and necessery calles interface = gr.Interface(fn = get_sentiment, inputs=gr.Textbox(label = "Enter the review :"), outputs = [gr.Textbox(label = "Sentiment :"), gr.Textbox(label = "Score :")], title = "Sentiment analysis protoype") #launch of the interface if __name__ == "__main__": interface.launch()