File size: 1,205 Bytes
e317d56
52b0ede
e317d56
52b0ede
 
e317d56
 
 
 
 
 
 
 
52b0ede
 
e317d56
 
46cc63a
e317d56
52b0ede
e317d56
52b0ede
e317d56
 
 
 
52b0ede
 
 
e317d56
52b0ede
e317d56
52b0ede
e317d56
 
 
 
 
 
 
 
 
 
 
 
 
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
# Architecture — youtube_hate_detector

## Runtime (production)

```mermaid
flowchart LR
  Browser[React SPA]
  API[FastAPI :8000]
  MS[ModelService]
  YT[YouTube Data API]
  Browser -->|HTTP JSON| API
  API --> MS
  API --> YT
```

- **UI:** `frontend/` built to `frontend/dist`, served by FastAPI `StaticFiles` in production.
- **Inference:** Only `ModelService` in `src/service/` loads models.
- **Catalog:** `configs/model_catalog.yaml` — baselines (LR, frozen BERT) + production meta-stack.
- **Suggested videos:** `configs/suggested_videos.yaml` — YouTube video IDs for the right rail.

## Local development

| Process | Command | Port |
|---------|---------|------|
| API | `uv run uvicorn src.api.main:app --reload` | 8000 |
| UI | `cd frontend && npm run dev` | 5173 (proxies API) |

## Docker

Single service `youtube_hate_detector-app` on port **8000** (API + static UI).

## API layout

```
src/api/
  main.py           # app factory, CORS, static mount
  schemas.py        # Pydantic models
  services.py       # predict helpers
  youtube.py        # comment fetch + metadata
  state.py          # shared app state
  routes/
    health.py
    models.py
    predict.py
    videos.py
```