Python Tutor Bot is a small educational AI app for beginner Python learners.
It can help with:
- Explaining Python concepts
- Debugging Python code
- Giving short quizzes
- Improving code quality
- Python
- Gradio
- OpenAI Python SDK
app.py→ Gradio app and OpenAI call logicprompts.py→ reusable prompt templates for all tutor modesrequirements.txt→ dependencies
- Clone or open this project
- Create and activate a virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate- Install dependencies
pip install -r requirements.txt- Set your OpenAI API key as an environment variable
export OPENAI_API_KEY="your_api_key_here"- Run the app
python app.py- Open the local Gradio URL shown in your terminal.
- Select a mode from the dropdown:
- Explain Concept
- Debug Code
- Quiz Me
- Improve Code
- Enter your Python question, concept, or code.
- Click Get Help.
- If your input box is empty, the app will ask you to enter text/code.
- If
OPENAI_API_KEYis missing, the app will show a clear setup message. - Keep prompts specific for better answers.