CoolFace
Apppublic

WGKPramuditha/maternal-health-bot

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

Maternal Health AI Assistant

A multimodal RAG chatbot built with Flask, LangChain, Gemini, and FAISS. It answers questions about maternal and newborn health (primarily in Sinhala) and can understand images.

How to embed it

Drop this snippet before the closing </body> tag of any website:

html
<script 
  src="https://your-username-your-space.hf.space/widget.js"
  data-api-key="YOUR_API_KEY"
  data-host="https://your-username-your-space.hf.space"
  data-color="#0f766e"
  data-name="Health Assistant"
  async>
</script>

Environment variables

Set these in your Space → Settings → Variables & secrets:

VariableRequiredDescription
APP_AUTH_KEYYesAPI key for widget embedding
GOOGLE_API_KEYYesYour Gemini API key

Optional (with defaults):

VariableDefaultDescription
DEBUGfalseFlask debug mode
LLM_MODELgemini-1.5-flashGemini model
LLM_TEMPERATURE0.3Response creativity
EMBEDDING_MODELall-MiniLM-L6-v2Sentence-transformer model
RETRIEVER_TOP_K3Chunks to retrieve
RATE_LIMIT30 per minutePer-IP rate limit
DB_FAISS_PATHvectorstore/db_faissFAISS index path
PDF_DATA_DIRdata/pdfsPDFs folder

Endpoints

EndpointMethodDescription
/healthGETHealth check + vectorstore status
/chatPOSTChat (requires x-api-key header)
/widget.jsGETWidget loader script
/widget/iframeGETChat iframe UI

Notes

  • —The FAISS vectorstore is pre-built at Docker build time — cold starts are fast.
  • —Runs on free CPU tier (2 GB RAM) — no GPU required.
  • —Responds in Sinhala when asked in Sinhala.