--- title: Time Card Generator emoji: ⏱️ colorFrom: green colorTo: blue sdk: streamlit sdk_version: 1.37.0 app_file: app.py pinned: false --- # Time Card Generator A Streamlit application for creating, editing, and saving shift cards to Firebase Realtime Database through simple HTTP requests. The UI is optimized for Hugging Face Streamlit Spaces and does not require Google Apps Script. ## Features - Add unlimited time cards - Edit title and start time inline - Automatically calculate end time as `+2 hours` - Save new cards and update existing cards - Delete cards locally or from Firebase - Load saved cards automatically on startup - Use `st.session_state` for responsive card management ## Project Structure ```text streamlit_app/ ├── app.py ├── requirements.txt ├── README.md ├── .gitignore ├── assets/ │ └── style.css ├── components/ │ ├── buttons.py │ ├── card.py │ └── header.py ├── services/ │ └── api.py ├── utils/ │ └── time_utils.py └── .streamlit/ └── secrets.toml.example ``` ## Configuration Create `.streamlit/secrets.toml` from the example file: ```toml FIREBASE_DATABASE_URL="https://smartedu-3d5bf-default-rtdb.firebaseio.com" FIREBASE_AUTH_TOKEN="" ``` This repository is already configured with the Firebase Realtime Database URL in `.streamlit/secrets.toml`: ```toml FIREBASE_DATABASE_URL="https://smartedu-3d5bf-default-rtdb.firebaseio.com" FIREBASE_AUTH_TOKEN="" ``` Notes: - Leave `FIREBASE_AUTH_TOKEN` empty if your Realtime Database rules allow direct access. - If your database rules require authentication, add a valid Firebase Database auth token there or as a Hugging Face Space secret. ## Run Locally ```bash cd streamlit_app python -m venv .venv source .venv/bin/activate pip install -r requirements.txt streamlit run app.py ``` ## Deploy to Hugging Face Streamlit Space 1. Create a new Hugging Face Space. 2. Choose `Streamlit` as the SDK. 3. Upload the contents of `streamlit_app/`. 4. This repo can run without extra edits because `.streamlit/secrets.toml` is included. 5. Optionally, add Hugging Face Space secrets named `FIREBASE_DATABASE_URL` and `FIREBASE_AUTH_TOKEN` if you prefer managing them outside the repo. 6. Commit and let the Space build automatically.