lichunming commited on
Commit
ca99a2f
·
verified ·
1 Parent(s): 97e5676

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # model=ProsusAI/finbert
5
+ pipe = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english")
6
+
7
+ # Prompt the user to enter financial data, each line treated as a separate string
8
+ text_input = st.text_area('Enter financial filing data (one entry per line)')
9
+
10
+ if text_input:
11
+ lines = text_input.strip().split("\n") # Split input by lines
12
+ outputs = [pipe(line) for line in lines] # Process each line with the pipeline
13
+
14
+ for line, out in zip(lines, outputs): # Display original lines and their corresponding output
15
+ st.write(f"Text: {line}")
16
+ st.json(out)