A lightweight AI-powered Physics and Chemistry tutor chatbot built with Flask and Google Gemini 2.5 Flash. Ask questions and get concise, conversational explanations — no textbook jargon.
- 🧪 Physics & Chemistry Focus — Tutor specialized in Physics and Chemistry topics
- 💬 Conversational Tone — Short, simple answers (3–5 lines) without textbook-style paragraphs
- ⚡ Powered by Gemini — Uses Google Gemini 2.5 Flash for fast, accurate responses
- 🌐 Web Interface — Clean chat UI served via Flask templates
- 🔌 REST API — Simple
/chatendpoint for integration with other apps
| Layer | Technology |
|---|---|
| Backend | Python, Flask |
| AI Model | Google Gemini 2.5 Flash |
| Frontend | HTML, CSS, JavaScript (Jinja2 templates) |
- Python 3.9+ installed
- A Google Gemini API Key (Get one here)
-
Clone the repository
git clone https://github.com/sujitha-kotyada/study-chatbot.git cd study-chatbot -
Create a virtual environment
python -m venv .venv
-
Activate the virtual environment
- Windows:
.venv\Scripts\activate
- macOS/Linux:
source .venv/bin/activate
- Windows:
-
Install dependencies
pip install flask google-genai
-
Configure your API key
Create a
.envfile in the project root:GEMINI_API_KEY=your_gemini_api_key_here
⚠️ Important: Never hardcode API keys in source code. Use environment variables. -
Run the application
python main.py
-
Open in browser
Navigate to http://localhost:5000
- Open the chat interface in your browser
- Type a Physics or Chemistry question
- Get a concise, conversational answer in seconds
- "What is Newton's third law?"
- "Explain covalent bonding"
- "Why does ice float on water?"
- "What is the difference between speed and velocity?"
Send a message and receive an AI response.
Request: application/json
{
"message": "What is Ohm's law?"
}Response: application/json
{
"reply": "Ohm's law states that the current flowing through a conductor is directly proportional to the voltage across it, given constant temperature. The formula is V = IR, where V is voltage, I is current, and R is resistance."
}study-chatbot/
├── main.py # Flask backend with Gemini AI integration
├── templates/
│ └── index.html # Chat UI frontend
└── README.md
This project is open source and available under the MIT License.
Sujitha Kotyada — @sujitha-kotyada