File size: 1,741 Bytes
34a66f3
 
 
 
99e970d
34a66f3
b69c4fd
34a66f3
 
 
 
 
 
 
3695273
34a66f3
3695273
99e970d
3695273
 
 
 
 
99e970d
3695273
 
99e970d
3695273
99e970d
3695273
34a66f3
99e970d
3695273
99e970d
 
 
 
 
 
34a66f3
3695273
 
 
34a66f3
3695273
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
title: Othaim ALPR API
emoji: πŸ…ΏοΈ
colorFrom: green
colorTo: indigo
sdk: gradio
sdk_version: 5.16.0
app_file: app.py
pinned: false
license: mit
---

# Othaim Parking ALPR - Backend API

FastAPI backend for the Othaim Markets parking management system, mounted with Gradio for free hosting on Hugging Face Spaces.

> Check out the HF Spaces configuration reference at [huggingface.co/docs/hub/spaces-config-reference](https://huggingface.co/docs/hub/spaces-config-reference).

---

## How ALPR Works (No Local Models Needed)

This backend does **not** require local model files (`car_plate_best.pt`, `model_ocr.pt`) in production.

* **Remote Mode (Default):** Set `MODEL_INFERENCE_PROVIDER=remote`. The backend sends images to the pre-deployed model Space at `pant0x-ealpr-ocr-v2.hf.space` and returns the results.
* **Local Mode:** Model files in the repo are intended for **local development** when running with `MODEL_INFERENCE_PROVIDER=local`.

---

## Environment Variables & Secrets

| Secret | Required | Default | Description |
|---|:---:|---|---|
| `SUPABASE_URL` | βœ… | β€” | Supabase project URL |
| `SUPABASE_ANON_KEY` | βœ… | β€” | Supabase anonymous key |
| `SUPABASE_SERVICE_ROLE_KEY` | βœ… | β€” | Supabase service role key |
| `CORS_ALLOW_ORIGINS` | ❌ | `*` | Allowed CORS origins |
| `MODEL_INFERENCE_PROVIDER` | ❌ | `remote` | `remote` (calls HF Space) or `local` |
| `MODEL_SERVICE_URL` | ❌ | `https://pant0x-ealpr-ocr-v2.hf.space` | Remote ALPR model URL |

---

## API Endpoints

- `/docs` β€” Interactive Swagger UI documentation
- `/health` β€” Health check status endpoint
- `/predict` β€” License plate recognition inference
- All 42 REST API endpoints are active and accessible via the Space wrapper.