Spaces:
Build error
Build error
File size: 1,778 Bytes
b748dad b3ecaa7 e48d543 b748dad e48d543 df4398a e48d543 b748dad b3ecaa7 b748dad ca663e1 e330a04 ca663e1 b748dad |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
import streamlit as st
from src.components import analysis, docs, faq, footer, form, presentation
from src.configs import SupportedFiles
from src.utils import convert_df, get_logo, read_file
# app configs
st.set_page_config(
page_title="Wordify",
initial_sidebar_state="expanded",
layout="centered",
page_icon="./assets/logo.png",
menu_items={
"Get Help": "https://github.com/MilaNLProc/wordify-webapp-streamlit/issues/new",
"Report a Bug": "https://github.com/MilaNLProc/wordify-webapp-streamlit/issues/new",
"About": "By the __Wordify__ team.",
},
)
# logo
st.sidebar.image(get_logo("./assets/logo.png"))
# title
st.title("Wordify")
# file uploader
uploaded_fl = st.sidebar.file_uploader(
label="Choose a file",
type=[i.name for i in SupportedFiles],
accept_multiple_files=False,
help="""
Supported formats:
- CSV
- TSV
- PARQUET
- XLSX (do not support [Strict Open XML Spreadsheet format](https://stackoverflow.com/questions/62800822/openpyxl-cannot-read-strict-open-xml-spreadsheet-format-userwarning-file-conta))
""",
)
if not uploaded_fl:
presentation()
faq()
else:
df = read_file(uploaded_fl)
outputs = form(df)
docs()
# change or create session state
if outputs is not None or "outputs" not in st.session_state:
st.session_state["outputs"] = outputs
# when procedure is performed
if st.session_state["outputs"] is not None:
df = analysis(st.session_state["outputs"])
payload = convert_df(df)
st.download_button(
label="Download data as CSV",
data=payload,
file_name="wordify_results.csv",
mime="text/csv",
)
# footer
footer()
|