|
1 | | -# Model-Testing |
2 | | -This is the interface of the first user interface we made to interact with our models and test how they work. |
| 1 | +# MzeeChakula — Model-Testing |
| 2 | + |
| 3 | +This repository contains the frontend and backend for the MzeeChakula nutrition recommendation and meal-planning prototype. The project provides: |
| 4 | + |
| 5 | +- An interactive, voice-enabled chat assistant for collecting user demographics and dietary preferences. |
| 6 | +- A prediction API that estimates daily caloric needs and recommends local foods based on nutritional similarity and learned models. |
| 7 | +- A small frontend app built with Vue + Vite + Pinia that consumes the backend API. |
| 8 | + |
| 9 | +## Live demos |
| 10 | + |
| 11 | +- Frontend (static UI): <https://mzeechakula.vercel.app/> |
| 12 | +- Backend API: <https://mzeechakula-backend.onrender.com/> |
| 13 | + |
| 14 | +## Quick links |
| 15 | + |
| 16 | +- Frontend folder: `frontend/` |
| 17 | +- Backend folder: `backend/` |
| 18 | + |
| 19 | +## Getting started (developer) |
| 20 | + |
| 21 | +1. Clone the repository: |
| 22 | + |
| 23 | +```bash |
| 24 | +git clone https://github.com/MzeeChakula/Model-Testing.git |
| 25 | +cd Model-Testing |
| 26 | +``` |
| 27 | + |
| 28 | +2.Backend (Python / FastAPI) |
| 29 | + |
| 30 | +- Requirements: Python 3.9+ and a virtual environment. |
| 31 | + |
| 32 | +```bash |
| 33 | +# from repo root |
| 34 | +cd backend |
| 35 | +python3 -m venv ../.venv |
| 36 | +source ../.venv/bin/activate |
| 37 | +pip install -r requirements.txt |
| 38 | +# Run the API server (development) |
| 39 | +uvicorn api.main:app --reload --host 127.0.0.1 --port 8000 |
| 40 | +``` |
| 41 | + |
| 42 | +Notes: |
| 43 | + |
| 44 | +- The backend serves endpoints under `/predict`, `/foods`, and `/health`. |
| 45 | +- Model files and optional embeddings are expected under `backend/models/`. If no trained models are present the backend falls back to a heuristic predictor so the API remains usable. |
| 46 | + |
| 47 | +3.Frontend (Vue / Vite) |
| 48 | + |
| 49 | +- Requirements: Node.js + npm (or yarn). |
| 50 | + |
| 51 | +```bash |
| 52 | +# from repo root |
| 53 | +cd frontend |
| 54 | +npm install |
| 55 | +# Run dev server |
| 56 | +npm run dev |
| 57 | +# Build for production |
| 58 | +npm run build |
| 59 | +``` |
| 60 | + |
| 61 | +- The frontend expects an API base URL in `VITE_API_URL` (defaults to `http://localhost:8000`). When running locally, start the backend first. |
| 62 | + |
| 63 | +Recommendations & troubleshooting |
| 64 | + |
| 65 | +- If the recommender system (embedding-based) is not available, the frontend falls back to scoring local foods by basic nutritional similarity; ensure `frontend/src/store/predictionStore.js` has been loaded and that `getLocalFoods` works (endpoint: `/foods/local`). |
| 66 | +- To include the built frontend in this repo for hosts like Vercel that can serve static output, the `dist/` folder can be committed — the project `.gitignore` has been updated to allow committing `dist`. |
| 67 | + |
| 68 | +Deploying |
| 69 | + |
| 70 | +- Frontend: Vercel (recommended). Point the Vercel project to the `frontend` directory or push the built `dist` folder to the repo and configure Vercel to serve it. |
| 71 | +- Backend: Render / Heroku / any container or VM. Ensure environment variables and model files are available on the host. |
| 72 | + |
| 73 | +Useful git commands (commit dist to repo) |
| 74 | + |
| 75 | +```bash |
| 76 | +# Force add a previously ignored folder (only if needed) |
| 77 | +git add -f frontend/dist |
| 78 | +git commit -m "Include built frontend dist for deployment" |
| 79 | +git push origin main |
| 80 | +``` |
| 81 | + |
| 82 | +Contributing |
| 83 | + |
| 84 | +- Open issues and PRs are welcome. Keep changes focused and add tests where appropriate. |
| 85 | + |
| 86 | +License |
| 87 | + |
| 88 | +- This repository is released under the terms in the `LICENSE` file. |
| 89 | + |
| 90 | +Contact |
| 91 | + |
| 92 | +- For questions, open an issue or contact the repository owner. |
0 commit comments