An open API service indexing awesome lists of open source software.

https://github.com/errec/is-replicant

FastAPI-based backend API for detecting AI-generated text
https://github.com/errec/is-replicant

Last synced: 10 months ago
JSON representation

FastAPI-based backend API for detecting AI-generated text

Awesome Lists containing this project

README

          

# is-Replicant - An AI-Generated Text Detection API

## Introduction

The **is-Replicant** project provides a FastAPI-based backend API for detecting AI-generated text. It analyzes text inputs using natural language processing techniques and returns probabilities indicating whether the text was generated by AI. The service uses PostgreSQL, follows secure API practices and Python data libraries.

## Development

Build and start the services with Docker Compose:

```bash
docker-compose build
docker-compose up -d
```

Swagger documentation:

- Swagger UI:
- ReDoc:
- OpenAPI JSON:

## Production Deployment

Build a standalone API image and run it with an environment file:

```bash
cp api/.env.example api/.env # update values for your environment
docker build -t is-replicant-api -f api/Dockerfile api
docker run --env-file api/.env -p 8000:8000 is-replicant-api
```

The repository includes a sample GitHub Actions workflow in
`.github/workflows/docker.yml` that builds the container and starts it with
temporary environment variables.

## Testing

Install dependencies and run the test suite:

```bash
pip install -r api/requirements.txt
pytest
```

## Database Population

Populate the database with the initial word and phrase data:

```bash
python db/populate_db.py
```

The script will prompt for confirmation before inserting records. Use the `--force` flag or the `POPULATE_DB_FORCE=1` environment variable to bypass the prompt in automated environments:

```bash
python db/populate_db.py --force
# or
POPULATE_DB_FORCE=1 python db/populate_db.py
```

## pgAdmin

- URL:
- Email: `admin@admin.com`
- Password: `admin`
- `POSTGRES_DB=is_replicant`
- `POSTGRES_USER=user`
- `POSTGRES_PASSWORD=password`

## TODO

- [x] CI/CD
- [x] Docker Setup
- [x] Project Initial Structure
- [x] Setting Up FastAPI Application
- [x] Database Migrations
- [x] Swagger
- [x] Text Analysis Service
- [x] Database Models
- [x] Database Connection and ORM Setup
- [x] Running with Uvicorn
- [x] Text Analysis Endpoints
- [x] Testing the API
- [x] Testing with Pytest
- [ ] Deploy API
- [ ] Set DB to cloud
- [x] Prompt before populate DB