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