File size: 499 Bytes
3cc2bda
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from transformers import pipeline
import gradio as gr

classifier = pipeline("sentiment-analysis")

def classify_text(text):
    result=classifier(text)
    label=result[0]['label']
    score = result[0]['score']

    return f"{label} with score {score}"

interface = gr.Interface(
    fn=classify_text,
    inputs=gr.Textbox("Write anything(*-_-)"),
    outputs="text",
    title="Serntiment Analysis",
    description="Enter Text to Check the Sentiment."
)

interface.launch(debug=True,share=True)