First_aid_snakebite / README.md
Nolist's picture
Update README.md
dc784c4 verified
|
Raw
History Blame Contribute Delete
4.89 kB

A newer version of the Streamlit SDK is available: 1.61.1

Upgrade
metadata
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 openai package):

    • 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; store OPENAI_API_KEY here locally if needed — do not commit).
  • data/victims.json — auto-created and appended with victim records by the app (add data/.gitkeep if 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.

  1. Create a virtual environment and activate it:
python -m venv .venv
# macOS / Linux
source .venv/bin/activate
# Windows (PowerShell)
.\.venv\Scripts\Activate.ps1
  1. Install dependencies:
pip install -r requirements.txt
  1. 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"
  1. Run the app:
streamlit run app.py

Open the address printed by Streamlit (usually http://localhost:8501).


Deploying to Hugging Face Spaces (Streamlit)

  1. Create a new Space on Hugging Face and choose Streamlit as the SDK.
  2. Push this repository (all files except secrets) to the Space.
  3. In the Space settings, add a secret named OPENAI_API_KEY with your OpenAI key. Do not commit secrets.toml to the repo.
  4. Start the Space — it will use app.py automatically.

Configuration & secrets

  • .streamlit/config.toml contains the UI theme and safe server defaults (headless mode, address 0.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_MODEL environment variable to override the default model used.
  • The app supports both the modern openai.OpenAI(api_key=...) client shape and the classic openai package usage (the code tries both imports).
  • data/victims.json is appended; if you want the directory tracked but empty, create data/.gitkeep and 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.py pages).
  • 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.