Spaces:
Sleeping
Sleeping
|
Download README.md from alezsd/lancaster-ner-api: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/alezsd/lancaster-ner-api/resolve/main/README.md
- Command line
-
hf download hf://spaces/alezsd/lancaster-ner-api/README.md
-
curl -L -o README.md https://huggingface.co/spaces/alezsd/lancaster-ner-api/resolve/main/README.md
1.4 kB
| title: Lancaster NER API | |
| emoji: 🏷️ | |
| colorFrom: blue | |
| colorTo: indigo | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| # Lancaster NER API | |
| API REST construida con **FastAPI** y **spaCy** para detección de entidades nombradas (NER). | |
| ## Endpoints | |
| ### `GET /` | |
| Health check — confirma que el modelo está cargado. | |
| ### `POST /annotate` | |
| Recibe un archivo `.txt` y devuelve las anotaciones NER. | |
| **Ejemplo con curl:** | |
| ```bash | |
| curl -X POST "https://<tu-usuario>-lancaster-ner-api.hf.space/annotate" \ | |
| -F "file=@documento.txt" | |
| ``` | |
| **Respuesta:** | |
| ```json | |
| { | |
| "filename": "documento.txt", | |
| "num_entities": 2, | |
| "entities": [ | |
| { | |
| "text": "London", | |
| "label": "GPE", | |
| "label_description": "Countries, cities, states", | |
| "start": 5, | |
| "end": 11 | |
| } | |
| ], | |
| "tokens": [...], | |
| "html_visualization": "<div>...</div>" | |
| } | |
| ``` | |
| ### `POST /annotate/text` | |
| Alternativa para enviar texto directamente como JSON. | |
| ```bash | |
| curl -X POST "https://<tu-usuario>-lancaster-ner-api.hf.space/annotate/text" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"text": "John lives in New York."}' | |
| ``` | |
| ## Documentación interactiva | |
| Disponible en `/docs` (Swagger UI) y `/redoc`. | |
| ## Modelo | |
| Por defecto usa `en_core_web_sm` de spaCy. Para usar un modelo propio, | |
| sube los archivos del modelo a la carpeta `models/` y ajusta la variable | |
| de entorno `NER_MODEL` en la configuración del Space. | |