Spaces:
Sleeping
Sleeping
metadata
title: Magbert Ner Api
emoji: π
colorFrom: yellow
colorTo: indigo
sdk: docker
pinned: false
short_description: magbert-ner-fr-api
Private BERT NER API on Hugging Face Space
This repo contains a private FastAPI-based NER API built on a Hugging Face BERT model.
Features
- Private Hugging Face model loading
- FastAPI REST endpoint for NER
- Token-based authentication (
X-API-KEY
) - Rate limiting per IP using
slowapi
- Usage tracking per API key
Run locally
export HF_TOKEN=your_hf_token
export X-API-KEY=your-secret-key
uvicorn app:app --reload
Example request
curl -X POST http://localhost:8000/ner \
-H "X-API-KEY: your-secret-key" \
-H "Content-Type: application/json" \
-d '{"text": "Barack Obama was the president of the United States."}'
Deployment
Can be deployed to Hugging Face Spaces (with Docker option enabled) or any cloud with Docker support.
Hugging Face Space Setup
- Make sure to enable Docker runtime
- Add two secrets:
HF_TOKEN
X-API-KEY