Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
@@ -1,42 +1,50 @@
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
title: SAMH
|
2 |
+
emoji: 📚
|
3 |
+
colorFrom: indigo
|
4 |
+
colorTo: blue
|
5 |
+
sdk: docker
|
6 |
+
pinned: false
|
7 |
+
license: apache-2.0
|
8 |
+
|
9 |
+
# Sentiment Analysis API
|
10 |
+

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