Download components/database_status.py from omgy/pcsales: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/omgy/pcsales/resolve/main/components/database_status.py
- Command line
-
hf download hf://spaces/omgy/pcsales/components/database_status.py
-
curl -L -o database_status.py https://huggingface.co/spaces/omgy/pcsales/resolve/main/components/database_status.py
1.07 kB
| # components/database_status.py | |
| import streamlit as st | |
| def show_database_status(db): | |
| """Show current database status""" | |
| st.sidebar.markdown("---") | |
| st.sidebar.subheader("π Database Status") | |
| try: | |
| if db: | |
| customers_count = len(db.get_dataframe('customers')) | |
| sales_count = len(db.get_dataframe('sales')) | |
| distributors_count = len(db.get_dataframe('distributors')) | |
| payments_count = len(db.get_dataframe('payments')) | |
| products_count = len(db.get_dataframe('products')) | |
| st.sidebar.metric("π₯ Customers", customers_count) | |
| st.sidebar.metric("π° Sales", sales_count) | |
| st.sidebar.metric("π€ Distributors", distributors_count) | |
| st.sidebar.metric("π³ Payments", payments_count) | |
| st.sidebar.metric("π¦ Products", products_count) | |
| else: | |
| st.sidebar.error("Database not available") | |
| except Exception as e: | |
| st.sidebar.error("Database connection issue") |