Spaces:
Sleeping
Sleeping
File size: 1,172 Bytes
f4a4bf9 0f43e0e f4a4bf9 0f43e0e f4a4bf9 0f43e0e f4a4bf9 0f43e0e f4a4bf9 |
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 48 49 50 51 52 53 54 55 56 57 58 |
---
title: Sentiment Analysis API
emoji: 😊
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
---
# Sentiment Analysis API
A FastAPI-based sentiment analysis service using ensemble machine learning models (KNN, Random Forest, Extra Trees).
## Features
- **Fast predictions** using pre-trained ML models from HuggingFace Model Hub
- **RESTful API** with automatic documentation
- **CORS enabled** for web frontend integration
- **Ensemble learning** for improved accuracy
## API Endpoints
### `GET /`
Health check and API information
### `GET /status`
Returns model status and readiness
### `POST /predict`
Analyzes sentiment of input text
**Request body:**
```json
{
"text": "Your text here"
}
```
**Response:**
```json
{
"predicted_sentiment": "positive",
"input_text": "Your text here"
}
```
## Models
This API downloads models from HuggingFace Model Hub: `anis80/anisproject`
- **Label Encoder**: Encodes sentiment labels
- **TF-IDF Vectorizer**: Converts text to numerical features
- **Voting Classifier**: Ensemble of KNN, Random Forest, and Extra Trees
## Documentation
Interactive API documentation available at `/docs` (Swagger UI)
|