ursbijju's picture
fix iface launch()
a8e88d9
raw
history blame contribute delete
681 Bytes
from transformers import pipeline
import gradio as gr
classifer = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
def analyze_sentiment(text):
result = classifer(text)[0];
return f"Label: {result['label']}, Score: {result['score']}"
iface = gr.Interface(fn=analyze_sentiment,
inputs=gr.Textbox(lines=2, placeholder="Enter text to analyze sentiment here..."),
outputs="text",
title="Sentiment Analysis",
description="Classify text as positive or negative sentiment using a pre-trained model DistilBert.")
# iface.launch(share=True)
iface.launch()