lynn-twinkl commited on
Commit ·
7b2a88d
1
Parent(s): ef6706a
Streamlit app
Browse files
app.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
################################
|
| 2 |
+
# CONFIGURATION
|
| 3 |
+
################################
|
| 4 |
+
|
| 5 |
+
import streamlit as st
|
| 6 |
+
import pandas as pd
|
| 7 |
+
|
| 8 |
+
# -- FUNCTIONS --
|
| 9 |
+
|
| 10 |
+
from functions.extract_usage import extract_usage
|
| 11 |
+
from functions.necessity_index import compute_necessity
|
| 12 |
+
from functions.column_detection import detect_freeform_answer_col
|
| 13 |
+
|
| 14 |
+
################################
|
| 15 |
+
# APP SCRIPT
|
| 16 |
+
################################
|
| 17 |
+
|
| 18 |
+
st.title("Grant Applications Helper")
|
| 19 |
+
|
| 20 |
+
uploaded_file = st.file_uploader("Upload grant applications file for analysis", type='csv')
|
| 21 |
+
|
| 22 |
+
if uploaded_file is not None:
|
| 23 |
+
df = pd.read_csv(uploaded_file)
|
| 24 |
+
|
| 25 |
+
st.markdown("""
|
| 26 |
+
### Data Preview
|
| 27 |
+
Here's the data you uploaded!
|
| 28 |
+
"""
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
st.dataframe(df)
|
| 32 |
+
|
| 33 |
+
## 0. PREPROCESSING
|
| 34 |
+
|
| 35 |
+
freeform_col = detect_freeform_answer_col(df) # <- detects the long-form column used for processing
|
| 36 |
+
|
| 37 |
+
docs = df[freeform_col].to_list()
|
| 38 |
+
|
| 39 |
+
## 1. EXTRACT GRANT USAGE
|
| 40 |
+
|
| 41 |
+
extracted_usage = extract_usage(docs)
|
| 42 |
+
|