Skip to content

alayzar/girl-code-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Girl Code AI 🐍

An AI-powered Python tutor that only speaks code. Ask her anything — she answers in Python. Type plain english? She'll send it back.

What is Girl Code?

Girl Code is a web-based chat application where you learn Python through conversation. The AI responds to every message entirely in runnable Python code, using comments for explanations and print() statements to communicate. If you type plain english instead of code, she'll correct you.

How It Works

Girl Code is powered by OpenAI's GPT API (a large language model). Here's the architecture:

  1. You type code → the Flask backend executes it in a sandboxed Python environment and captures the output
  2. Your code + output is sent to the GPT API along with a system prompt that tells the AI to respond only in valid Python code
  3. The AI generates a response — it's not pre-written. Every reply is created dynamically based on your conversation
  4. The response is executed too — so you see both the code and its output
  5. If you type plain english, a regex-based detector catches it and returns a correction before it ever hits the API

The system prompt defines Girl Code's personality and teaching rules: always respond in Python, show broken vs fixed code when errors happen, track concept progression, and end every reply with a challenge.

User Input → Code Detection → Execute Code → GPT API → Execute Response → Display
                  ↓
            Plain English? → Sassy Correction 💅

Features

  • Code-only responses — every reply is valid, runnable Python
  • Code execution — responses are executed and output is displayed
  • Plain english detection — type english and she'll tell you to try again in code
  • Clean iPhone-style UI — modern, minimal chat interface
  • Promo & demo pages — ready-made marketing assets

Setup

1. Clone the repo

git clone https://github.com/dstaton2034/girl-code-ai.git
cd girl-code-ai

2. Install dependencies

pip install -r requirements.txt

3. Add your OpenAI API key

Create a .env file in the project root:

OPENAI_API_KEY=your-api-key-here

Get a key at platform.openai.com/api-keys

4. Run it

python app.py

Open http://localhost:5000 in your browser.

Pages

Page URL Description
Chat / The main Girl Code chat interface

Tech Stack

  • Python + Flask
  • OpenAI API (GPT-3.5-turbo)
  • HTML/CSS/JS (no frameworks)

License

MIT

About

An AI-powered Python tutor that only speaks code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors