Spaces:
Runtime error
Runtime error
Update app.py
Browse files3 unmodified lines456789101112131415161718193 unmodified lines# Load the text classification pipelinepipeline = pipeline("text-classification", model="ProsusAI/finbert", trust_remote_code=True)def predict(input_text): # Corrected argument namepredictions = pipeline(input_text, threshold=0.5, return_scores=False)return predictions[0] # Extract the first prediction# Define the Gradio interfacegradio_app = gr.Interface(predict,inputs=gr.Textbox(label="Write a text"),outputs=gr.Textbox(label="Predicted Sentiment"), # More descriptive labeltitle="Financial Sentiment Analysis", # More specific title)# Launch the Gradio interface3 unmodified lines4567891011121314151617181920212223243 unmodified lines# Load the text classification pipelinepipeline = 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=gr.Label(label="Predicted Sentiment Probabilities"),components=[gr.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 interface
app.py+10-5