lichunming commited on
Commit
b1db100
·
verified ·
1 Parent(s): 9772630

Create app.py

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