Spaces:
Runtime error
Runtime error
Update app.py
Browse files4 unmodified lines567891011121314151617181920212223244 unmodified linespipeline = pipeline("text-classification", model="ProsusAI/finbert", trust_remote_code=True)def predict(input_text):predictions = pipeline(input_text, threshold=0.5, return_scores=True)return predictions[0]gradio_app = gr.Interface(predict,inputs=gr.Textbox(label="Write a text"),outputs=None,components=[gr.Label(label="Label: {}".format(predictions[0]["label"])),gr.Label(label="Score: {:.2f}".format(predictions[0]["score"][0])),],title="Financial Sentiment Analysis",)# Launch the Gradio interfaceif __name__ == "__main__":gradio_app.launch()4 unmodified lines5678910111213141516171819202122232425264 unmodified linespipeline = pipeline("text-classification", model="ProsusAI/finbert", trust_remote_code=True)def predict(input_text):predictions = pipeline(input_text, threshold=0.5, return_scores=True)return predictions[0]# Define the Gradio interfacegradio_app = gr.Interface(predict,inputs=gr.Textbox(label="Write a text"),outputs=None, # Remove outputs herecomponents=[ # Add components to display probabilitiesgr.Label(label="Neutral: {:.2f}".format(predictions[0]["score"][0])),gr.Label(label="Positive: {:.2f}".format(predictions[0]["score"][1])),gr.Label(label="Negative: {:.2f}".format(predictions[0]["score"][2])),],title="Financial Sentiment Analysis",)# Launch the Gradio interfaceif __name__ == "__main__":gradio_app.launch()
app.py+13-11