Spaces:
Runtime error
Runtime error
Commit ·
efb3a3f
1
Parent(s): 214013d
Update app.py
Browse files1233456789108910111213import gradio as grfrom transformers import pipeline
nlp = pipeline("sentiment-analysis")
def scoring(text): results = nlp(text) for result in results: score = result['score'] return score sentiment = results[0]['label'] # Get the sentiment label (e.g., 'LABEL_1' or 'LABEL_2') score = results[0]['score'] # Get the sentiment score return f"Sentiment: {sentiment}, Score: {score}"
iface = gr.Interface(fn=scoring, inputs="text", outputs="text")iface.launch()app.py+7-4