|
|
|
from transformers import pipeline |
|
from huggingface_hub import InferenceClient |
|
import gradio as gr |
|
|
|
model = pipeline("sentiment-analysis") |
|
|
|
def get_sentiment(input_text): |
|
analysis = model(input_text) |
|
sent = analysis[0]['label'] |
|
score = analysis[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 :")], title = "Sentiment analysis protoype") |
|
|
|
|
|
if __name__ == "__main__": |
|
interface.launch() |