Spaces:
Sleeping
Sleeping
|
Download README_HF.md from snvskiit/content_processor: direct link, hf CLI and curl.
- Browser
- Download file 2.9 kB
-
https://huggingface.co/spaces/snvskiit/content_processor/resolve/main/README_HF.md
- Command line
-
hf download hf://spaces/snvskiit/content_processor/README_HF.md
-
curl -L -o README_HF.md https://huggingface.co/spaces/snvskiit/content_processor/resolve/main/README_HF.md
2.9 kB
| title: Address Detection and Summarization API | |
| emoji: π π | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| license: mit | |
| # Address Detection and Summarization API | |
| A FastAPI service that provides two main endpoints for AI-powered text processing: | |
| ## π Features | |
| - π **Address Detection**: Extracts and formats addresses from unstructured text | |
| - π **Text Summarization**: Creates concise summaries with sentiment analysis | |
| - π€ **OpenAI Integration**: Uses GPT-4 for natural language processing | |
| - π **Secure**: API key required via `x-api-key` header | |
| - π **Sentiment Analysis**: Returns sentiment label and score (-1.0 to 1.0) | |
| ## π API Endpoints | |
| ### Root & Health | |
| - `GET /` - API information | |
| - `GET /health` - Health check | |
| - `GET /docs` - Interactive API documentation | |
| ### Address Detection | |
| `POST /address-detection` | |
| Extract addresses from text content. | |
| **Request:** | |
| ```json | |
| { | |
| "entity_urn": "unique_id", | |
| "content": "Please send to 123 Main Street, New York, NY 10001" | |
| } | |
| ``` | |
| **Headers:** | |
| ``` | |
| Content-Type: application/json | |
| x-api-key: your_openai_api_key | |
| ``` | |
| ### Text Summarization | |
| `POST /summarize` | |
| Generate summary with sentiment analysis. | |
| **Request:** | |
| ```json | |
| { | |
| "entity_urn": "unique_id", | |
| "content": "Your text content to summarize..." | |
| } | |
| ``` | |
| ## π§ Usage Examples | |
| ### Using curl: | |
| ```bash | |
| # Address Detection | |
| curl -X POST "https://your-space-name.hf.space/address-detection" \ | |
| -H "Content-Type: application/json" \ | |
| -H "x-api-key: your_openai_api_key" \ | |
| -d '{"entity_urn": "test", "content": "Send to 123 Main St, NYC"}' | |
| # Summarization | |
| curl -X POST "https://your-space-name.hf.space/summarize" \ | |
| -H "Content-Type: application/json" \ | |
| -H "x-api-key: your_openai_api_key" \ | |
| -d '{"entity_urn": "test", "content": "I love this product!"}' | |
| ``` | |
| ### Response Format: | |
| ```json | |
| { | |
| "message": "success", | |
| "result": "extracted_addresses || separated", | |
| "action_type": "detect_address", | |
| "entity_urn": "test", | |
| "sentiment": null | |
| } | |
| ``` | |
| For summarization, `sentiment` contains: | |
| ```json | |
| { | |
| "label": "positive", | |
| "score": 0.8 | |
| } | |
| ``` | |
| ## π Authentication | |
| You need an OpenAI API key to use this service: | |
| 1. Get your API key from [OpenAI Platform](https://platform.openai.com/) | |
| 2. Include it in the `x-api-key` header with each request | |
| 3. No registration required - just use your own key | |
| ## ποΈ Built With | |
| - **FastAPI** 0.115.14 - Modern web framework | |
| - **OpenAI** 1.92.1 - AI language models | |
| - **Pydantic** 2.11.7 - Data validation | |
| - **Python** 3.12 - Runtime | |
| ## π Documentation | |
| Visit `/docs` for interactive API documentation with request/response examples and testing interface. | |
| ## π Security & Privacy | |
| - Your OpenAI API key is required for each request | |
| - No API keys are stored on our servers | |
| - All requests are processed in real-time | |
| - No conversation history is retained | |