Spaces:
Sleeping
A newer version of the Streamlit SDK is available: 1.61.1
title: Fist-aid assitant
emoji: 🚀
colorFrom: blue
colorTo: green
sdk: streamlit
sdk_version: 1.33.0
app_file: app.py
pinned: false
Snakebit Firstaid 🚀
Short description: Web application that provides quick, essential first-aid guidance for snakebite (poisoned wound) and normal wounds, and then offers an advanced ChatGPT-powered assistant to deliver tailored next-step guidance.
Features
Simple, two-panel quick-first-aid interface:
- Left: Snakebite (poisoned wound) — short essential steps.
- Right: Normal wound — short essential steps.
- Users confirm completion and press Next → Advanced which forwards the wound type to the advanced assistant.
Advanced assistant powered by OpenAI ChatGPT (via the
openaipackage):- Confirms basic-first-aid steps completed.
- Collects victim information (name, age, height, weight, notes).
- Saves victim info to
./data/victims.json. - Provides in-depth, concise first-aid & monitoring steps and supports follow-up questions.
Safe defaults for deployment (server settings in
.streamlit/config.toml).
Files in the repo
app.py— main Streamlit app (single-file app).requirements.txt— project dependencies..streamlit/config.toml— UI theme + server defaults..streamlit/secrets.toml— (empty by default; storeOPENAI_API_KEYhere locally if needed — do not commit).data/victims.json— auto-created and appended with victim records by the app (adddata/.gitkeepif you want the empty folder tracked)..gitignore— prevents committing secrets, virtualenvs, and local data.README.md— this document.
Quick start (local)
Tested with Python 3.10+ (recommend 3.11). Adjust if your environment differs.
- Create a virtual environment and activate it:
python -m venv .venv
# macOS / Linux
source .venv/bin/activate
# Windows (PowerShell)
.\.venv\Scripts\Activate.ps1
- Install dependencies:
pip install -r requirements.txt
- Provide your OpenAI API key securely. Recommended options:
- Add to environment (temporary):
export OPENAI_API_KEY="sk-..."
# Windows PowerShell
$env:OPENAI_API_KEY = "sk-..."
- OR (local only, not for public repos) add to
.streamlit/secrets.toml:
OPENAI_API_KEY = "sk-REPLACE_WITH_YOUR_KEY"
# Optionally set the model
# OPENAI_MODEL = "gpt-4o-mini"
- Run the app:
streamlit run app.py
Open the address printed by Streamlit (usually http://localhost:8501).
Deploying to Hugging Face Spaces (Streamlit)
- Create a new Space on Hugging Face and choose Streamlit as the SDK.
- Push this repository (all files except secrets) to the Space.
- In the Space settings, add a secret named
OPENAI_API_KEYwith your OpenAI key. Do not commitsecrets.tomlto the repo. - Start the Space — it will use
app.pyautomatically.
Configuration & secrets
.streamlit/config.tomlcontains the UI theme and safe server defaults (headless mode, address0.0.0.0, disabled XSRF for certain container environments).- Never commit
.streamlit/secrets.toml(contains API keys). Add it to.gitignore(already provided).
Security & emergency notes
- This app is not a substitute for professional medical care. It gives short, essential guidance to assist non-professionals.
- If a victim is deteriorating, losing consciousness, has severe bleeding, or you suspect life-threatening poisoning, call local emergency services immediately.
- The app stores victim records in
./data/victims.json. Treat this as potentially sensitive information; if you deploy publicly, review data retention policies and consider adding encryption or removing storage.
Requirements
See requirements.txt. Minimal runtime packages include streamlit and openai. Optionally include toml, python-dotenv, and Pillow.
Development notes
- The app accepts
OPENAI_MODELenvironment variable to override the default model used. - The app supports both the modern
openai.OpenAI(api_key=...)client shape and the classicopenaipackage usage (the code tries both imports). data/victims.jsonis appended; if you want the directory tracked but empty, createdata/.gitkeepand commit it.
Contributing
If you want improvements (multi-page separation, richer UI, persistent DB, authentication, localization), open an issue or send a pull request. I can help implement features such as:
- Separate pages for the simple/advanced parts (actual
next.pypages). - Better UX: progress indicators, larger touch targets, i18n (Vietnamese + English).
- Replace local JSON file with small database (SQLite) or cloud storage for multi-user deployments.
License
Add a license (e.g., MIT) — currently not set in this repo.