File size: 1,432 Bytes
aa76da4
937e579
 
aa76da4
937e579
aa76da4
937e579
aa76da4
8a40fe9
aa76da4
fa1f6e5
aa76da4
fa1f6e5
aa76da4
8a40fe9
 
 
fa1f6e5
aa76da4
fa1f6e5
aa76da4
fa1f6e5
aa76da4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fa1f6e5
aa76da4
937e579
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
---
title: SAMH
emoji: 
colorFrom: purple
colorTo: blue
sdk: docker
pinned: true
license: mit
short_description: Sentment Analysis for Mental Health
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

# Sentiment Analysis API

![image/png](https://cdn-uploads.huggingface.co/production/uploads/62ba22a1c70f4e318161fbf1/XrOrikgkTeNBAukxPklWE.png)


This project provides a sentiment analysis API using FastAPI and a machine learning model trained on textual data.

## Features

- Data ingestion and preprocessing
- Model training and saving
- FastAPI application for serving predictions
- Dockerized for easy deployment

## Setup

### Prerequisites

- Docker installed on your system

### Build and Run

1. Build the Docker image:

    ```bash
    docker build -t sentiment-analysis-api .
    ```

2. Run the Docker container:

    ```bash
    docker run -p 8000:8000 sentiment-analysis-api
    ```

3. Access the API:

    - Home: [http://localhost:8000](http://localhost:8000)
    - Health Check: [http://localhost:8000/health](http://localhost:8000/health)
    - Predict Sentiment: Use a POST request to [http://localhost:8000/predict_sentiment](http://localhost:8000/predict_sentiment) with a JSON body.

## Example cURL Command

```bash
curl -X POST "http://localhost:8000/predict_sentiment" -H "Content-Type: application/json" -d '{"text": "I love programming in Python."}'