CoolFace
Apppublic

uapb/ai

sourceHugging Facemitupdated 1mo agoView on Hugging Face
0likes
App README

AquaVision — Fish Nutrigenomics & AI Lab (UAPB)

AI-powered detection and weight estimation for aquaculture species, built by the Fish Nutrigenomics & AI Lab at the University of Arkansas at Pine Bluff (Dr. Yathish Ramena, Director).

Two-model architecture served by a FastAPI backend:

  • —Shrimp / Prawn → local YOLO segmentation model (models/weights.pt)
  • —Largemouth Bass → YOLOv11s-seg (models/lmb_weights.pt) → mask → px/cm calibration → allometric curve → weight (g)

Layout

server/            FastAPI backend — routes only; the work lives in the packages
  main.py            the app  (uvicorn target: server.main:app)
  startup.py         container entrypoint: fetch weights, then exec uvicorn
aquavision_tool/   fish detection, in-process
  models.py          weights, species config, calibration constants
  analysis.py        detection → morphometrics → weight
jem_agent/         Flask chat agent — persona, session memory, SSE streaming
  app.py             the Flask app  (flask --app jem_agent.app)
  chat.py            what server/main.py relays through
  persona.py         the system prompt and the canned replies
web/               everything the browser is allowed to fetch
  index.html         the site
  css/style.css
  assets/            logos, portraits, Jem artwork
models/            YOLO weights — gitignored, fetched on first boot
scripts/           run + deploy helpers
logs/              runtime logs — gitignored

Only web/ is exposed over HTTP, mounted at /static.

Both packages are imported from the repo root, so anything that starts them must run from there — jem_agent/app.py reaches its persona as a package sibling, which only resolves with the root on sys.path.

How it runs

This is a Docker Space. On cold start, `server/startup.py` downloads the model weights (and video assets) from Google Drive, then launches uvicorn server.main:app on port 7860.

Configuration

Nothing secret is committed. Everything below is read from the environment — locally via export or a .env, on Hugging Face via Settings → Variables and secrets, where values are injected into the container at runtime and never appear in the repo, the build log, or to visitors.

VariableSecret?DefaultPurpose
ROBOFLOW_API_KEYyes(unset)Hosted bass detector, used only when models/lmb_weights.pt is missing. Unset = fallback off, /health reports roboflow_configured: false.
DB_HOST / DB_USER / DB_PASSWORD / DB_NAMEyeslocalhost / root / (empty) / aquaculture_chatbotJem's MySQL knowledge base. Optional — without it Jem answers from Ollama alone.
OLLAMA_URLnohttp://localhost:11434Model server behind Jem.
OLLAMA_MODELnollama3.2:3bChat model.
CHATBOT_URLnohttp://localhost:5000Where the site proxies /chat.
PORTno7860Listen port, if the host injects one.

Local development

bash
./scripts/run-jem.sh           # ollama + jem-agent + site, quick test
./scripts/install-services.sh  # the same stack as supervised systemd user units
./scripts/run-local.sh         # site + a public Cloudflare tunnel

Deploying

bash
./scripts/deploy-hf.sh         # pushes to the Hugging Face Space

Note that a git push to GitHub does not rebuild the Space.

Endpoints

  • —GET / — the AquaVision website
  • —GET /health — model + config status
  • —POST /detect/bass — largemouth bass weight prediction
  • —POST /detect?species=... — shrimp/prawn detection
  • —POST /chat, POST /chat/stream — proxied to the Jem agent
  • —GET /species — configured species
  • —GET /docs — interactive API docs