Spaces:
Sleeping
Sleeping
|
Download README.md from HFPRXV/autoinventory: direct link, hf CLI and curl.
- Browser
- Download file 4.27 kB
-
https://huggingface.co/spaces/HFPRXV/autoinventory/resolve/main/README.md
- Command line
-
hf download hf://spaces/HFPRXV/autoinventory/README.md
-
curl -L -o README.md https://huggingface.co/spaces/HFPRXV/autoinventory/resolve/main/README.md
4.27 kB
| title: AutoInventory | |
| emoji: π | |
| colorFrom: indigo | |
| colorTo: blue | |
| sdk: docker | |
| pinned: false | |
| # AutoInventory | |
| AI-powered property inventory report generator. Upload a 1-minute walkthrough video and receive a professional PDF inventory report. | |
| ## Tech Stack | |
| ### Frontend | |
| - **React 18** with Vite | |
| - **Tailwind CSS 3** β dark theme with copper accent palette | |
| - Client-side drag-and-drop upload with live elapsed timer and stage tracking | |
| ### Backend | |
| - **FastAPI** β single POST endpoint (`/api/generate-report`) | |
| - **Uvicorn** β ASGI server | |
| - **FFmpeg** β frame extraction (1 frame every 5 seconds) | |
| - **ReportLab** β PDF generation with professional layout (cover page, room tables, declaration) | |
| ### Machine Learning (Hugging Face Transformers) | |
| - **Vision model**: `nlpconnect/vit-gpt2-image-captioning` β captions each extracted frame | |
| - **Text model**: `google/flan-t5-small` β generates executive summary only | |
| - Both run locally on CPU via PyTorch β no external APIs, no API keys, fully open-source | |
| ### Infrastructure | |
| - **Docker** β multi-stage build (Node β React dist, Python β FastAPI) | |
| - **Hugging Face Docker Spaces** β deployment target (port 7860) | |
| ## How It Works | |
| ### Pipeline | |
| 1. **Upload** β User drags an MP4/MOV video onto the React UI | |
| 2. **Frame Extraction** β FFmpeg extracts one frame every 5 seconds into `/tmp` | |
| 3. **Captioning** β Each frame is passed through `vit-gpt2-image-captioning` to generate a text description (e.g. "a living room with a couch and a coffee table") | |
| 4. **Room Classification** β Each caption is matched against keyword lists to determine the room (Living Room, Kitchen, Bedroom, etc.). No LLM involved β pure keyword matching. | |
| 5. **Item Generation** β For each room, standard inventory items (Door, Ceiling, Walls, Skirting, Window, Flooring, etc.) are created. Descriptions are sourced from the captions that best match each item type. | |
| 6. **Executive Summary** β `flan-t5-small` (via Hugging Face transformers pipeline) writes a one-paragraph summary of the inspection | |
| 7. **PDF Build** β ReportLab assembles a professional multi-page PDF with cover page, table of contents, room-by-room tables, and declaration page | |
| 8. **Download** β PDF is returned to the browser and automatically downloaded | |
| 9. **Cleanup** β Background task removes video, frames, and PDF from `/tmp` | |
| ### File Structure | |
| ``` | |
| βββ backend/ | |
| β βββ main.py # FastAPI app, pipeline, PDF builder | |
| β βββ requirements.txt # Python dependencies | |
| βββ frontend/ | |
| β βββ src/ | |
| β β βββ App.jsx # React upload UI with timer | |
| β βββ package.json | |
| β βββ vite.config.js | |
| βββ Dockerfile # Multi-stage build for HF Spaces | |
| βββ README.md | |
| ``` | |
| ### Agents | |
| No CrewAI or agent framework is used. The pipeline is a linear sequence of function calls: | |
| | Step | Function | What it does | | |
| |------|----------|-------------| | |
| | Frame extraction | `extract_frames()` | Calls FFmpeg | | |
| | Captioning | `get_frame_captions()` | Runs vision model on each frame | | |
| | Room classification | `classify_room()` | Keyword matching | | |
| | Item assembly | `run_inventory_pipeline()` | Builds structured data in Python | | |
| | Summary | `LocalTextLLM.call()` | Runs text model once | | |
| | PDF | `build_pdf_report()` | ReportLab layout | | |
| Previous iterations attempted multi-agent orchestration with CrewAI and API-based models (Gemini, Groq), but these were replaced with the current fully-local, sequential approach for reliability and zero external dependencies. | |
| ## Environment Variables | |
| | Variable | Default | Description | | |
| |----------|---------|-------------| | |
| | `LOCAL_TEXT_MODEL` | `google/flan-t5-small` | Hugging Face model for text generation | | |
| | `LOCAL_VISION_MODEL` | `nlpconnect/vit-gpt2-image-captioning` | Hugging Face model for image captioning | | |
| ## Running Locally | |
| ```bash | |
| # Backend | |
| cd backend | |
| pip install -r requirements.txt | |
| uvicorn main:app --host 0.0.0.0 --port 7860 | |
| # Frontend (separate terminal) | |
| cd frontend | |
| npm install | |
| npm run dev | |
| ``` | |
| ## Deployment | |
| Deploys to Hugging Face Docker Spaces. Only requirement is a valid HF token: | |
| ```bash | |
| git push https://<USER>:<HF_TOKEN>@huggingface.co/spaces/<USER>/<SPACE> main | |
| ``` | |