sanjay-genai/Tiles
0
TilesView AI - Room Upload Validation System
Production-grade hybrid AI backend for validating room uploads before Tilesview visualization.
Core Design
- Deep learning semantic understanding: CLIP ViT model for object/scene intent.
- Classical CV scoring: edge density, grid regularity, color consistency.
- Rule engine: Tilesview room-upload policy.
- Explainable output: deterministic reason + user message.
Active Business Policy
- Default mode is
room_upload. - Accept only real indoor room photos with visible wall or floor surfaces.
- Reject product close-ups, samples, screenshots, plans, drawings, and unrelated objects.
- Product design validation is a separate workflow and is not the default behavior in this app.
Strict 14-Step Pipeline
- Input validation (blank/corrupted/too-small/low-information rejection).
- Preprocessing (224x224 semantic path, 64x64 CV path).
- Semantic understanding (
tile,room,furniture,object,outdoor,invalid_scene). - Scene validation.
- Tile relevance check.
- Classical CV feature analysis.
- Semantic confidence extraction.
- Fusion score computation:
model_score = 0.5*semantic + 0.2*edge + 0.2*grid + 0.1*color - Final classification mapping.
- Multi-label tagging.
- Verdict engine:
Validonly if indoor/tile-applicable andmodel_score >= 0.5. - Reason generation.
- Thumbnail class generation.
- Mandatory user-facing message.
Strict JSON Contract
{
"classification": "",
"labels": [],
"confidence": 0.0,
"edge_score": 0.0,
"grid_score": 0.0,
"color_score": 0.0,
"model_score": 0.0,
"verdict": "Valid / Invalid",
"reason": "",
"thumbnail_class": "",
"user_message": ""
}confidence, edge_score, grid_score, color_score, and model_score are all in the range [0.0, 1.0].
Run Locally
Install dependencies:
pip install -r requirements.txtRun FastAPI backend:
uvicorn api:app --host 0.0.0.0 --port 8000Call API:
curl -X POST "http://localhost:8000/analyze" \
-H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/image.jpg"Inspect the active backend policy:
curl "http://localhost:8000/policy"Run Gradio demo:
python app.pyRun single-image CLI prediction:
python predict.py "/path/to/image.jpg"Hugging Face Deployment
For API deployment on Hugging Face:
- Create a Docker Space.
- Push this repository as-is (includes
Dockerfile). - Space will serve FastAPI at port
7860. - Use
POST /analyzewith multipart image file input.
Or deploy directly from local machine:
set HF_TOKEN=hf_xxx
python deploy_to_hf_space.py --username YOUR_HF_USERNAME --space-name tilesview-ai-validatorEvaluation
python evaluation/evaluate.py --images-dir "../data set" --manifest data/dataset_manifest.jsonResults are saved to evaluation/results/eval_results.json.
