File size: 370 Bytes
7931bb8
257a521
7931bb8
 
257a521
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from transformers import pipeline


classifier = pipeline("sentiment-analysis")


def check_sentiment(phrase: str) -> str:
    classification = classifier(phrase)
    return classification[0]["label"]


def main():
    iface = gr.Interface(fn=check_sentiment, inputs="text", outputs="text")
    iface.launch()


if __name__ == "__main__":
    main()