Logo Lanfrica

Ahmadubaismail/QualiFood_Ai

Domain:

agriculturenatural language processing

Record type:

software
Creator:
Ahm
Host:
Offline food safety intelligence app for African markets — built for Africa Deep Tech Challenge 2026 # QualiFood AI — Local RAG Backend (For Africa Deep Tech Challenge 2026) This file explains how to run a real on-device LLM + RAG on your computer, so QualiFood AI can answer food safety/agriculture questions **completely offline**. ## What's Included ``` qualifood-rag/ ├── knowledge_base/ # Food safety/agriculture reference data (.txt files) │ ├── aflatoxin.txt │ ├── haccp_basics.txt │ ├── postharvest_storage.txt │ ├── foodborne_pathogens.txt │ ├── cold_chain.txt │ ├── food_labeling_packaging.txt │ ├── market_food_safety.txt │ ├── water_safety.txt │ └── meat_fish_hygiene.txt ├── rag_engine.py # ChromaDB retrieval logic ├── app.py # FastAPI server (RAG + Ollama) ├── requirements.txt ├── qualifood-ai.html # Frontend (now includes the "Ask AI" tab) └── README.md ``` ## Step-by-Step Setup ### 1. Install Ollama Ollama is the simplest way to run an LLM locally without a GPU. - Download from: ollama.com - Choose the version for your OS (Windows/Mac/Linux) - After installing, open a terminal/command prompt and run: ``` ollama --version ``` If it shows a version number, it's working. ### 2. Pull a Small Model In the terminal: ``` ollama pull qwen2.5:1.5b ``` This model is around ~1GB and is designed to run comfortably on 8GB RAM machines without a GPU — matching the ADTC Standard Laptop spec. **Other model options** (if you want to experiment): - `phi3.5` — from Microsoft, strong at reasoning - `qwen2.5:3b` — larger, better quality answers, but slower Change the model name in `app.py` (the line `MODEL_NAME = "qwen2.5:1.5b"`) if you pick a different one. ### 3. Install Python Dependencies Make sure you have Python 3.10+ installed. Then: ``` cd qualifood-rag pip install -r requirements.txt ``` ### 4. Run the Backend ``` uvicorn app:app --reload --port 8000 ``` On the first run, it will take a moment to: 1. Read every `.txt` file in `knowledge_base/` 2. Split them into chunks and …