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.
Build and start the services with Docker Compose:
docker-compose build
docker-compose up -dSwagger documentation:
- Swagger UI: http://localhost:8000/api/v1/docs
- ReDoc: http://localhost:8000/api/v1/redoc
- OpenAPI JSON: http://localhost:8000/api/v1/openapi.json
Build a standalone API image and run it with an environment file:
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-apiThe repository includes a sample GitHub Actions workflow in
.github/workflows/docker.yml that builds the container and starts it with
temporary environment variables.
Install dependencies and run the test suite:
pip install -r api/requirements.txt
pytestPopulate the database with the initial word and phrase data:
python db/populate_db.pyThe 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:
python db/populate_db.py --force
# or
POPULATE_DB_FORCE=1 python db/populate_db.py- URL: http://localhost:5050
- Email:
admin@admin.com - Password:
admin POSTGRES_DB=is_replicantPOSTGRES_USER=userPOSTGRES_PASSWORD=password
- CI/CD
- Docker Setup
- Project Initial Structure
- Setting Up FastAPI Application
- Database Migrations
- Swagger
- Text Analysis Service
- Database Models
- Database Connection and ORM Setup
- Running with Uvicorn
- Text Analysis Endpoints
- Testing the API
- Testing with Pytest
- Deploy API
- Set DB to cloud
- Prompt before populate DB