File size: 671 Bytes
9ed15f8
 
30e3b8f
9ed15f8
30e3b8f
 
9ed15f8
30e3b8f
 
 
 
 
9ed15f8
 
30e3b8f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from transformers import pipeline ##
import gradio as gr               ## to get all librarioies

sentiment = pipeline("sentiment-analysis") ## this my model


def get_sentiment(text):                  ## this mt function at model
  sent = sentiment(text)[0]['label']
  score = sentiment(text)[0]['score']
  return sent, score

interface = gr.Interface(fn = get_sentiment, inputs=gr.Textbox(label="Enter the review"), outputs = [gr.Textbox(label = "Sentiment :"), gr.Textbox(label = "Score :")])
                                        ## my interface app to use my function
if __name__ =="__main__":               ## running my app on hugging face
    interface.launch()