Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
|
| 3 |
+
import streamlit as st
|
| 4 |
+
import pandas as pd
|
| 5 |
+
|
| 6 |
+
def process_financial_data(file):
|
| 7 |
+
try:
|
| 8 |
+
df = pd.read_csv(file)
|
| 9 |
+
|
| 10 |
+
income_statement = df[df['Type'] == 'Income Statement']
|
| 11 |
+
balance_sheet = df[df['Type'] == 'Balance Sheet']
|
| 12 |
+
cash_flow = df[df['Type'] == 'Cash Flow Statement']
|
| 13 |
+
|
| 14 |
+
return income_statement, balance_sheet, cash_flow
|
| 15 |
+
except Exception as e:
|
| 16 |
+
st.error(f"Error processing file: {e}")
|
| 17 |
+
return None, None, None
|
| 18 |
+
|
| 19 |
+
st.title("Financial Accounting App")
|
| 20 |
+
st.write("Upload a financial data file (CSV) to generate statements.")
|
| 21 |
+
|
| 22 |
+
uploaded_file = st.file_uploader("Upload CSV file", type=["csv"])
|
| 23 |
+
|
| 24 |
+
if uploaded_file is not None:
|
| 25 |
+
income_stmt, balance_sht, cash_flw = process_financial_data(uploaded_file)
|
| 26 |
+
|
| 27 |
+
if income_stmt is not None:
|
| 28 |
+
st.subheader("Income Statement")
|
| 29 |
+
st.dataframe(income_stmt)
|
| 30 |
+
|
| 31 |
+
st.subheader("Balance Sheet")
|
| 32 |
+
st.dataframe(balance_sht)
|
| 33 |
+
|
| 34 |
+
st.subheader("Cash Flow Statement")
|
| 35 |
+
st.dataframe(cash_flw)
|
| 36 |
+
|
| 37 |
+
st.write("Developed for financial statement analysis.")
|