Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,13 +1,54 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Text2textwithDockers
|
| 3 |
+
emoji: 🏃
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: red
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
license: mit
|
| 9 |
+
---
|
| 10 |
|
| 11 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 12 |
|
| 13 |
+
# Sentiment Analysis API
|
| 14 |
+

|
| 15 |
|
| 16 |
+
This project provides a sentiment analysis API using FastAPI and a machine learning model trained on textual data.
|
| 17 |
|
| 18 |
+
## Features
|
| 19 |
|
| 20 |
+
- Data ingestion and preprocessing
|
| 21 |
+
- Model training and saving
|
| 22 |
+
- FastAPI application for serving predictions
|
| 23 |
+
- Dockerized for easy deployment
|
| 24 |
+
|
| 25 |
+
## Setup
|
| 26 |
+
|
| 27 |
+
### Prerequisites
|
| 28 |
+
|
| 29 |
+
- Docker installed on your system
|
| 30 |
+
|
| 31 |
+
### Build and Run
|
| 32 |
+
|
| 33 |
+
1. Build the Docker image:
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
docker build -t sentiment-analysis-api .
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
2. Run the Docker container:
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
docker run -p 8000:8000 sentiment-analysis-api
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
3. Access the API:
|
| 46 |
+
|
| 47 |
+
- Home: [http://localhost:8000](http://localhost:8000)
|
| 48 |
+
- Health Check: [http://localhost:8000/health](http://localhost:8000/health)
|
| 49 |
+
- Predict Sentiment: Use a POST request to [http://localhost:8000/predict_sentiment](http://localhost:8000/predict_sentiment) with a JSON body.
|
| 50 |
+
|
| 51 |
+
## Example cURL Command
|
| 52 |
|
| 53 |
+
```bash
|
| 54 |
+
curl -X POST "http://localhost:8000/predict_sentiment" -H "Content-Type: application/json" -d '{"text": "I love programming in Python."}'
|