Spaces:
Running
Running
Commit ·
3dee06e
1
Parent(s): 84bb476
Update project structure in docs after refactor
Browse filesCo-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ARCHITECTURE.md +16 -14
- README.md +22 -25
ARCHITECTURE.md
CHANGED
|
@@ -56,22 +56,24 @@ services/classifier.py
|
|
| 56 |
|
| 57 |
```
|
| 58 |
app/
|
| 59 |
-
├── main.py
|
| 60 |
-
├──
|
| 61 |
-
├──
|
| 62 |
-
├──
|
| 63 |
-
├──
|
| 64 |
-
├──
|
| 65 |
-
|
| 66 |
-
│ ├── pages.py # Rutas HTML
|
| 67 |
-
│ ├── inference.py # Endpoints de clasificación
|
| 68 |
-
│ └── meta.py # Endpoints de health y categorías
|
| 69 |
├── services/
|
| 70 |
-
│ └── classifier.py
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
├── home.html
|
| 73 |
-
├── index.html
|
| 74 |
-
├── batch.html
|
| 75 |
└── categories.html
|
| 76 |
training/
|
| 77 |
├── config.py
|
|
|
|
| 56 |
|
| 57 |
```
|
| 58 |
app/
|
| 59 |
+
├── main.py # Lifespan + registro de routers
|
| 60 |
+
├── utils.py # normalize(), read_static()
|
| 61 |
+
├── core/ # Infraestructura compartida
|
| 62 |
+
│ ├── cache.py # Cache LRU thread-safe
|
| 63 |
+
│ ├── model_loader.py # Descarga el modelo desde HF Hub al iniciar
|
| 64 |
+
│ ├── schemas.py # Modelos Pydantic v2 para request/response
|
| 65 |
+
│ └── category_meta.py # Labels, colores y ejemplos por categoría
|
|
|
|
|
|
|
|
|
|
| 66 |
├── services/
|
| 67 |
+
│ └── classifier.py # Lógica de inferencia con integración de caché
|
| 68 |
+
├── api/ # Endpoints JSON
|
| 69 |
+
│ ├── inference.py # POST /classify, POST /classify/batch
|
| 70 |
+
│ └── meta.py # GET /health, GET /api/categories
|
| 71 |
+
├── web/ # Endpoints HTML
|
| 72 |
+
│ └── pages.py # Rutas de UI
|
| 73 |
+
└── templates/ # Archivos HTML
|
| 74 |
├── home.html
|
| 75 |
+
├── index.html # UI clasificador simple
|
| 76 |
+
├── batch.html # UI clasificador por lotes
|
| 77 |
└── categories.html
|
| 78 |
training/
|
| 79 |
├── config.py
|
README.md
CHANGED
|
@@ -1,13 +1,3 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: SMS Classifier API
|
| 3 |
-
emoji: 📱
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: purple
|
| 6 |
-
sdk: docker
|
| 7 |
-
app_port: 7860
|
| 8 |
-
pinned: false
|
| 9 |
-
---
|
| 10 |
-
|
| 11 |
# SMS Classifier API
|
| 12 |
|
| 13 |
API REST para clasificar mensajes SMS en categorías usando **DistilBERT multilingual** con fine-tuning sobre un dataset sintético multilingüe (ES + EN).
|
|
@@ -42,23 +32,30 @@ API REST para clasificar mensajes SMS en categorías usando **DistilBERT multili
|
|
| 42 |
|
| 43 |
```
|
| 44 |
app/
|
| 45 |
-
├── main.py
|
| 46 |
-
├──
|
| 47 |
-
|
| 48 |
-
│ ├──
|
| 49 |
-
│
|
|
|
|
|
|
|
| 50 |
├── services/
|
| 51 |
-
│ └── classifier.py
|
| 52 |
-
├──
|
| 53 |
-
├──
|
| 54 |
-
|
| 55 |
-
├──
|
| 56 |
-
└──
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
training/
|
| 58 |
-
├── config.py
|
| 59 |
-
├── generate_dataset.py
|
| 60 |
-
├── train.py
|
| 61 |
-
└── eval_report.py
|
| 62 |
```
|
| 63 |
|
| 64 |
## Correr localmente
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# SMS Classifier API
|
| 2 |
|
| 3 |
API REST para clasificar mensajes SMS en categorías usando **DistilBERT multilingual** con fine-tuning sobre un dataset sintético multilingüe (ES + EN).
|
|
|
|
| 32 |
|
| 33 |
```
|
| 34 |
app/
|
| 35 |
+
├── main.py # App entry point
|
| 36 |
+
├── utils.py # normalize(), read_static()
|
| 37 |
+
├── core/ # Infraestructura compartida
|
| 38 |
+
│ ├── cache.py # LRU cache thread-safe
|
| 39 |
+
│ ├── model_loader.py # Carga del modelo al startup
|
| 40 |
+
│ ├── schemas.py # Modelos Pydantic
|
| 41 |
+
│ └── category_meta.py # Metadata de categorías
|
| 42 |
├── services/
|
| 43 |
+
│ └── classifier.py # Lógica de inferencia + caché LRU
|
| 44 |
+
├── api/ # Endpoints JSON
|
| 45 |
+
│ ├── inference.py # POST /classify, POST /classify/batch
|
| 46 |
+
│ └── meta.py # GET /health, GET /api/categories
|
| 47 |
+
├── web/ # Endpoints HTML
|
| 48 |
+
│ └── pages.py # Rutas de UI
|
| 49 |
+
└── templates/ # Archivos HTML
|
| 50 |
+
├── home.html
|
| 51 |
+
├── index.html
|
| 52 |
+
├── batch.html
|
| 53 |
+
└── categories.html
|
| 54 |
training/
|
| 55 |
+
├── config.py # Hiperparámetros
|
| 56 |
+
├── generate_dataset.py # Genera training/data/sms_dataset.csv
|
| 57 |
+
├── train.py # Fine-tuning script
|
| 58 |
+
└── eval_report.py # Reporte de métricas por categoría
|
| 59 |
```
|
| 60 |
|
| 61 |
## Correr localmente
|