test1 / app.py
lichunming's picture
Create app.py
ca99a2f verified
raw
history blame contribute delete
665 Bytes
import streamlit as st
from transformers import pipeline
# model=ProsusAI/finbert
pipe = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english")
# Prompt the user to enter financial data, each line treated as a separate string
text_input = st.text_area('Enter financial filing data (one entry per line)')
if text_input:
lines = text_input.strip().split("\n") # Split input by lines
outputs = [pipe(line) for line in lines] # Process each line with the pipeline
for line, out in zip(lines, outputs): # Display original lines and their corresponding output
st.write(f"Text: {line}")
st.json(out)