A Streamlit-powered AI app that generates structured, exam-oriented UPSC Mains-style answers using Google Gemini.
It follows official UPSC answer-writing best practices β with clear introductions, multi-dimensional subheadings, and crisp conclusions enriched with data, committee references, and government reports.
β
Generates high-quality, analytical UPSC-style answers
β
Automatically structures answers with:
- Introduction (2 lines, with data or background)
- Multi-dimensional body (logical subheadings + bullet points)
- Conclusion (2 lines, with optimism and real references)
β
Clean Streamlit UI with fixed footer
β
Adjustable word limit
β
Real-time generation using Google Gemini API
| Component | Technology Used |
|---|---|
| Frontend/UI | Streamlit |
| Backend | Python |
| AI Model | Google Gemini (via pydantic_ai) |
| Environment | dotenv |
| Libraries | streamlit, google-genai, pydantic, python-dotenv |
Follow the steps below to set up and run the UPSC Mains Answer Generator locally.
git clone https://github.com/laleetborse/upsc-answer-generator.git
cd upsc-answer-generatorpython3 -m venv venv
source venv/bin/activatepip install -r requirements.txtGEMINI_KEY=your_google_gemini_api_key_herestreamlit run main.py