Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

HumaniseAI — Make AI Text Sound Human

Paste AI-generated text and get a natural, human-sounding version with an AI detection score — before and after.

Features

  • 4 writing modes — Casual, Professional, Student, Creative
  • AI detection scoring — heuristic score (0-100%) before and after rewriting
  • JWT auth — register/login, each user sees only their own history
  • Rewrite history — all rewrites saved to PostgreSQL, accessible anytime
  • Side-by-side view — original vs humanised text

Tech Stack

Layer Tech
Frontend Next.js 15, TypeScript, Tailwind CSS
Backend FastAPI (Python)
Database PostgreSQL
LLM Groq (llama-3.3-70b-versatile) — free
Auth JWT (bcrypt passwords)
Deploy Vercel (frontend) + Render (backend)

Local Setup

Step 1 — Backend

cd backend
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env

Edit backend/.env:

DATABASE_URL=postgresql://postgres:password@localhost:5432/humaniser
SECRET_KEY=any-long-random-string
GROQ_API_KEY=your_groq_key   # free at console.groq.com

Start PostgreSQL (Docker easiest):

docker run -d --name humaniser-db \
  -e POSTGRES_PASSWORD=password \
  -e POSTGRES_DB=humaniser \
  -p 5432:5432 postgres:15

Run backend:

uvicorn main:app --reload
# → http://localhost:8000
# → API docs: http://localhost:8000/docs

Step 2 — Frontend

cd frontend
npm install
cp .env.example .env.local
npm run dev
# → http://localhost:3000

How the AI Detection Score Works

The heuristic scorer checks for patterns common in AI-generated text:

  • AI-typical phrases — "it is important to note", "furthermore", "delve into", "leverage" etc.
  • Sentence length uniformity — AI tends to write similarly-lengthed sentences
  • Passive voice ratio — AI overuses passive constructions
  • Lack of contractions — AI often avoids "don't", "it's", "can't"
  • Perfect paragraph structure — AI writes suspiciously balanced paragraphs

Score: 0-100% (higher = more AI-like)


How the Humanisation Works

Each mode uses a carefully engineered system prompt that:

  1. Instructs the LLM to avoid specific AI-typical phrases
  2. Requests varied sentence lengths
  3. Encourages natural contractions and imperfections
  4. Sets the appropriate tone for the mode

The LLM used is llama-3.3-70b-versatile via Groq (free tier).


Deploy

Backend → Render:

  1. Push to GitHub
  2. New Web Service → connect repo, root = backend/
  3. Build: pip install -r requirements.txt
  4. Start: uvicorn main:app --host 0.0.0.0 --port $PORT
  5. Add env vars + a free Render PostgreSQL database

Frontend → Vercel:

  1. New Project → import repo, root = frontend/
  2. Add: NEXT_PUBLIC_API_URL=https://your-render-url.onrender.com
  3. Deploy!

Project Structure

humaniser/
├── backend/
│   ├── main.py                  # FastAPI app
│   ├── database.py              # PostgreSQL setup
│   ├── auth_utils.py            # JWT helpers
│   ├── requirements.txt
│   └── routers/
│       ├── auth.py              # /auth/register, /auth/login
│       └── humanise.py          # /humanise/ + AI scoring logic
│
└── frontend/
    └── src/
        ├── app/
        │   ├── dashboard/page.tsx   # Main tool + history
        │   ├── login/page.tsx       # Auth page
        │   └── globals.css
        └── lib/
            ├── api.ts               # Axios client
            └── auth-context.tsx     # Auth state

Interview Talking Points

  • Prompt engineering — system prompts designed to avoid specific AI patterns
  • Heuristic AI detection — custom scoring algorithm using regex + NLP patterns
  • JWT auth — full register/login flow with bcrypt password hashing
  • PostgreSQL — relational DB for user and rewrite history storage
  • FastAPI — async Python backend with dependency injection
  • Full-stack — Next.js frontend + FastAPI backend, separately deployable

About

AI text humaniser — rewrites AI-generated content across 4 tones using Groq LLaMA, with Sapling AI detector + custom heuristic scorer for weighted combined detection score. Built with FastAPI, Next.js, PostgreSQL and JWT auth.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages