Skip to content

Commit

Permalink
feat: add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamSilveiraF committed Oct 29, 2023
1 parent f05b9f1 commit e40bce1
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 7 deletions.
Binary file added Diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM python:3.9-slim-buster

RUN apt-get update && \
apt-get install -y ffmpeg

WORKDIR /app

COPY . /app
Expand Down
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Sentiment Analysis FastAPI Project

This is a sentiment analysis API developed with FastAPI

### Prerequisites

- Docker
- Docker Compose
- Google Cloud Platform
- PostgreSQL

### Configuration

#### Environment Variables

Create a file named `.env` in the project root directory and add your configurations, following the example below:

```env
POSTGRES_DB=sentimentanalysis_db
POSTGRES_USER=username
POSTGRES_PASSWORD=password
HOST=localhost | db | IP
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${HOST}:5432/${POSTGRES_DB}
GCP_CREDENTIALS_FILE=gcp.json
```

Google Cloud Credentials

To authenticate with the Google Cloud Platform, you'll need to create a service account, download the JSON key file, and set the GCP_CREDENTIALS_FILE environment variable in your .env file to point to this key file.


```json
{
"type": "service_account",
"project_id": "",
"private_key_id": "",
"private_key": "",
"client_email": "",
"client_id": "",
"auth_uri": "",
"token_uri": "",
"auth_provider_x509_cert_url": "",
"client_x509_cert_url": "",
"universe_domain": ""
}
```
#### Installing

```sh
git clone https://github.com/WilliamSilveiraF/sentiment-analysis.git


cd sentiment-analysis


docker compose up
```

#### Usage

```sh
The server is up and running at http://localhost:8080/
```

#### Flow Diagram

![all text](https://github.com/WilliamSilveiraF/sentiment-analysis/blob/main/Diagram.png)
12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ services:
- mynet
volumes:
- uploaded_audio:/app/uploaded_audio
- ./gcp.json:/app/gcp.json
- ./${GCP_CREDENTIALS_FILE}:/app/${GCP_CREDENTIALS_FILE}
environment:
- GOOGLE_APPLICATION_CREDENTIALS=/app/gcp.json
- GOOGLE_APPLICATION_CREDENTIALS=/app/${GCP_CREDENTIALS_FILE}
db:
image: postgres:16
container_name: sentimentanalysis-db
environment:
POSTGRES_DB: sentimentanalysis_db
POSTGRES_USER: william
POSTGRES_PASSWORD: password
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- "5432:5432"
volumes:
Expand All @@ -35,4 +35,4 @@ networks:

volumes:
postgres_data:
uploaded_audio:
uploaded_audio:
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fastapi import FastAPI
from api.routes import audio # FIXME LOAD MODEL BEFORE INITIALIZATION
from api.routes import audio
from middlewares import cors_middleware
import db

Expand Down

0 comments on commit e40bce1

Please sign in to comment.