CoolFace
Apppublic

Pagornsun/gistda-ml

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

GISTDA ML Inference Service

ML service แยกจาก Vercel — แบก onnxruntime ได้เต็มที่ (Vercel bundle จำกัด 250MB) รันบน Hugging Face Spaces (Docker, ฟรี ไม่ต้องบัตร)

[Vercel /api/forecast?model=onnx] ──POST /predict/hotspots──> [HF Space]
   (เบา ไม่มี onnxruntime)                                    FastAPI + onnxruntime
                                                              โหลดโมเดลจาก R2

Endpoints

pathหน้าที่
GET /healthเช็คว่าโหลดโมเดลจาก R2 ได้
POST /predict/hotspotsพยากรณ์จุดความร้อน (รับ daily_hotspots + weather)

ไฟล์

ไฟล์หน้าที่
app.pyFastAPI
features.pycopy จาก src/ml_features.py (feature ตรงกับตอนเทรน)
r2.pycopy จาก src/cloud_storage.py (ดึงโมเดลจาก R2)
Dockerfileimage

Secrets (ตั้งใน Space settings — ไม่ commit ลง repo)

R2_ACCOUNT_ID, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, R2_BUCKET

⚠️ features.py ต้อง sync กับ src/ml_features.py เสมอ (แก้ feature → copy ใหม่ + เทรนใหม่)