Skip to content

About

AI-powered study assistant that analyzes study material, explains concepts, and supports exam-oriented learning with Google Gemini.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š StudyLens AI

Snap it. Understand it. Learn it.

StudyLens AI is an AI-powered study assistant that helps students understand study material, simplify complex concepts, prepare exam-oriented answers, and analyze question papers using Google Gemini.

Python Streamlit Google Gemini Multimodal Languages License: MIT


Table of Contents


Overview

StudyLens AI is a Streamlit web application that turns photographed study material into an interactive study session.

Students commonly work with material such as:

  • textbook pages
  • handwritten and classroom notes
  • diagrams and labelled figures
  • technical study material
  • question papers
  • previous-year papers

Instead of reading through everything manually, a student can photograph the material and study it conversationally. The student uploads an image of the material, and StudyLens AI reads the visible text, headings, questions, formulas, diagrams, labels, and captions in that image. The uploaded image and the conversation are then sent to a Google Gemini multimodal model, which responds with explanations, summaries, important points, or exam-oriented answers depending on what the student asks for.

Because the app keeps a single Gemini chat session alive for the study session, follow-up questions such as "explain this in 5 marks" or "give the important points" continue from the study material already uploaded β€” the student does not need to upload the same page again.

StudyLens AI is intentionally built as a focused single-purpose tool: image-based study understanding with a conversational follow-up loop.


Problem Statement

Students routinely face the following difficulties while preparing for exams:

  • Lengthy material β€” a single textbook page or chapter can contain more information than a student can process in one reading.
  • Technical concepts β€” definitions, architectures, and processes are often written in dense academic language that is hard to convert into a simple understanding.
  • Identifying what matters β€” students struggle to separate the important points from supporting detail.
  • Answer length for marks β€” the same topic needs a short answer for 2 marks and a structured answer for 16 marks, and this restructuring takes effort.
  • Repeated questions β€” students want to know which questions repeat across the question papers they have collected, but comparing many papers manually is slow.

These are everyday study-workflow problems, not exotic ones β€” and they are exactly the problems a multimodal study assistant can reduce.


Solution

StudyLens AI provides an image-based conversational learning workflow built on Gemini's multimodal capabilities. The student photographs the material, and the assistant reads it and explains it in the way the student asks for.

Upload study material
        ↓
AI analyzes the content
        ↓
Understand the topic
        ↓
Get summary / important points
        ↓
Ask follow-up questions
        ↓
Prepare exam-oriented answers

The study material in the image is treated as the primary source. The assistant's instructions require it to use the terminology, formulas, questions, and structure that are actually present in the uploaded material, to say when something is not supported by the material, and to label any general knowledge separately. Answers are never lengthened with invented information.


Key Features

Feature Description
πŸ“· Image-based Study Analysis Upload a photo of a textbook page, notes, question paper, question bank, diagram, or previous-year paper and have it read and analyzed
πŸ“– Simple Explanations Complex or densely written concepts are re-explained in student-friendly language
πŸ“ Summaries Uploaded material is converted into an easy, concise summary
⭐ Important Points Key concepts, definitions, formulas, and processes supported by the material are listed out
πŸ”’ Step-by-Step Explanation Processes, work flows, and "working" questions are explained as numbered steps in the order of the material
✍️ Exam Answers Answers are generated according to the requested marks (2, 5, 10, 13, 15, or 16 marks)
πŸ’¬ Follow-up Questions The conversation remembers the chat context and re-attaches the uploaded study image, so follow-ups such as "explain this", "step 7", or "give me a 5-mark answer" work without re-uploading the image
πŸ”— Related Question Suggestions After each image-based answer, 3-4 topic-specific follow-up questions are offered as one-click buttons
πŸ“‘ Question Paper Analysis Uploaded question papers are analyzed for repeated, similar, and concept-level recurring questions
πŸ” Repeated Questions Exact repeats, differently worded questions, and same-concept questions are reported separately with frequency evidence
🌐 Multilingual Interaction Ask in English, Tamil, or Tanglish and the assistant answers in the matching language style
πŸ–ΌοΈ Multimodal Input A single message can contain an image, text, or both (JPG, JPEG, PNG, WEBP)
🧠 Session-scoped Context A new study session can be started at any time, which clears the chat and starts a fresh conversation
πŸ›‘οΈ Safe Answering Rules The system prompt forbids invented sources, invented exam predictions, and unsupported technical details
↻ Transient-error Recovery Failed model calls caused by temporary service errors are retried automatically before showing a friendly message

How It Works

Student
   ↓
Student Details
   ↓
StudyLens AI Interface
   ↓
Upload Study Material
   ↓
Image + Text Processing
   ↓
Prompt + Conversation Context
   ↓
Google Gemini Multimodal AI
   ↓
Structured Study Response
   ↓
Student
  1. Student opens the app and sees the onboarding screen.
  2. Student details β€” name and phone number are entered and validated, then kept only in the Streamlit session state.
  3. StudyLens AI interface β€” the study workspace opens with a sidebar containing "What you can ask", a New Session button, and the study chat.
  4. Upload study material β€” the student attaches an image (and/or types a question) in the chat input.
  5. Image + text processing β€” the upload is validated (JPG / JPEG / PNG / WEBP), the image is displayed in the conversation, and the bytes are converted into a multimodal part for the model.
  6. Prompt + conversation context β€” the matching prompt is applied: the full image analysis prompt for an image-only upload, or the student's own question when text is supplied. Every follow-up re-attaches the stored study image together with the follow-up prompt, so the answer stays grounded in the same material, and a system prompt defines the assistant's rules for the whole conversation.
  7. Google Gemini multimodal AI β€” the Gemini chat session receives the parts.
  8. Structured study response β€” the reply is rendered as Markdown (topic, summary, important points, steps, exam focus, question bank analysis, and so on). The suggestion block requested from the model is parsed out and presented as Related questions buttons below the latest answer.
  9. Student reads the answer and continues with follow-up questions.

Detailed diagrams are available in docs/ARCHITECTURE.md.

StudyLens AI architecture


Exam-Oriented Learning

Answer length and depth are controlled by the marks the student asks for. The mark value is passed to the assistant together with the question, and the answer structure changes accordingly.

Requested marks Expected answer style
2 Marks Short and focused β€” a definition plus one or two essential points, with no long introduction or unnecessary examples
5 Marks Moderately detailed β€” definition or introduction, the main explanation, and important points or an example when the material supports it
10 / 13 / 15 / 16 Marks Structured long-form answer β€” introduction, definition, main concept, components, working or step-by-step process, advantages, limitations, applications, and conclusion, but only for the parts the material supports

Answers are designed to remain grounded in the uploaded study material and the conversation context. When the material does not contain enough information for the requested depth, the assistant is instructed to say so instead of filling the gap with unsupported textbook content.

StudyLens AI does not predict examination questions. It restructures and explains the material the student provides.


Question Paper Analysis

When a question paper, question bank, or previous-year paper is uploaded, the assistant extracts the visible questions and reports:

  • exact repeated questions β€” the same question appearing more than once
  • similarly worded questions β€” the same intent expressed with different wording
  • recurring concepts β€” different questions that test the same underlying topic
  • frequency within the supplied question set β€” how often a question or concept appears across the papers that were provided

The assistant is explicitly instructed to separate exact repeat, similar question, and same concept instead of treating them as duplicates, and to phrase findings as evidence, for example "appears in 3 provided papers".

Question importance analysis is based on the question papers provided by the user and does not guarantee future examination questions.


Multilingual Support

StudyLens AI can be used in the language a student is most comfortable thinking in:

Language How it is handled
English Questions asked in English are answered in clear English
Tamil Questions asked in Tamil are answered in simple Tamil
Tanglish Tamil typed in English letters is understood, and the answer is given naturally in simple Tamil / Tanglish

Important technical terms are kept in English when that improves clarity β€” so a definition can be explained in Tamil while the technical keyword itself stays recognizable for the exam answer.

Language selection is automatic: there is no language toggle to configure, the student simply types in the language they prefer.


Screenshots

The application has two main screens: the student onboarding screen and the study workspace. Both are documented in this repository's asset folder.

Asset note: screenshot files are stored in assets/screenshots/. The expected file names, captions, and capture guidance are documented in assets/screenshots/README.md. Once the image files are present, uncomment the image tags below to render them here.

Student Onboarding

Students enter their basic details before starting a study session.

Study Workspace

Students can upload study material and interact with StudyLens AI.

Question Paper Analysis

Repeated, similar, and concept-level recurring questions identified from the uploaded question papers.


Tech Stack

Layer Technology Purpose
Language Python Application logic and prompt configuration
Web UI Streamlit Onboarding form, chat interface, image upload, sidebar, Markdown rendering
AI SDK google-genai (Google Gen AI SDK) Gemini client, multimodal chat sessions, content configuration
AI Model Google Gemini multimodal model (MODEL_NAME in app.py) Reads the uploaded image and text, generates the study response
Input Formats JPG, JPEG, PNG, WEBP Uploaded study material
Prompt Layer prompts.py System prompt rules, welcome message, image analysis prompt, follow-up prompt

There is no database, no user account system, and no separate frontend build step β€” the whole application is two Python modules plus the Streamlit runtime.


Project Structure

StudyLens_AI/
β”‚
β”œβ”€β”€ app.py
β”œβ”€β”€ prompts.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ .gitignore
β”‚
β”œβ”€β”€ .streamlit/
β”‚   └── secrets.toml.example
β”‚
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ screenshots/
β”‚   β”‚   β”œβ”€β”€ onboarding.png
β”‚   β”‚   β”œβ”€β”€ study-session.png
β”‚   β”‚   └── analysis.png
β”‚   β”‚
β”‚   └── architecture/
β”‚       └── architecture.svg
β”‚
└── docs/
    β”œβ”€β”€ ARCHITECTURE.md
    └── PROJECT_OVERVIEW.md
File Description
app.py Streamlit application: onboarding, study workspace, session state, Gemini client, request handling, error handling
prompts.py All prompt text: system prompt, welcome message, image analysis prompt, follow-up prompt
requirements.txt Runtime dependencies
.streamlit/secrets.toml.example Template showing the expected secrets file format (the real secrets.toml is never committed)
assets/architecture/architecture.svg High-level architecture diagram
docs/ARCHITECTURE.md Detailed architecture documentation with Mermaid diagrams
docs/PROJECT_OVERVIEW.md Project overview, user journey, scope, and roadmap

Getting Started

Prerequisites

  • Python 3.x
  • A Google Gemini API key from Google AI Studio
  • Internet access (all AI processing happens through the Gemini API)

1. Clone the repository

git clone https://github.com/abinesh-0/StudyLens_AI.git
cd StudyLens_AI

2. Create and activate a virtual environment

python -m venv venv
# Windows
venv\Scripts\activate

# macOS / Linux
source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Add your API key

Copy the template and fill in your own key:

# Windows
copy .streamlit\secrets.toml.example .streamlit\secrets.toml

# macOS / Linux
cp .streamlit/secrets.toml.example .streamlit/secrets.toml

.streamlit/secrets.toml:

GEMINI_API_KEY = "your-google-ai-studio-api-key"

.streamlit/secrets.toml is listed in .gitignore and must never be committed.

5. Run the application

streamlit run app.py

The app opens in your browser. Enter a name and phone number, click Let's Study πŸš€, then upload a study image and start asking questions.


Configuration

Setting Where it is defined Current value
Gemini API key .streamlit/secrets.toml β†’ GEMINI_API_KEY Supplied by the user locally
Gemini model MODEL_NAME in app.py gemini-3.5-flash-lite
Accepted upload formats st.chat_input(file_type=[...]) in app.py jpg, jpeg, png, webp
Validated MIME types ALLOWED_IMAGE_TYPES in app.py image/jpeg, image/png, image/webp
Retry delays for transient errors RETRY_DELAYS_SECONDS in app.py (1, 2, 4) seconds
Assistant behaviour SYSTEM_PROMPT in prompts.py Source-first, mark-aware, honesty-constrained study assistant

Deployment note: on a hosted platform such as Streamlit Community Cloud, provide the same key through that platform's secrets editor instead of committing a local file.


Scope and Limitations

StudyLens AI is deliberately honest about what it does and does not do. The current implementation is:

Not implemented What that means in practice
❌ Live web search No Google Search, no web browsing, and no online verification is performed. The assistant is instructed not to claim that it searched the web
❌ YouTube search or YouTube API No video lookup or video-based analysis
❌ Database / user accounts No sign-up, login, cloud database, or stored study history. Everything lives in the Streamlit session and is lost when the session ends
❌ Progress analytics No dashboards, streaks, or performance tracking
❌ WhatsApp / Twilio messaging The phone number entered during onboarding is kept only in the session state β€” it is never transmitted and no message is sent
❌ PDF or document processing Study material must be uploaded as an image (JPG, JPEG, PNG, WEBP)
❌ AI image or diagram generation Diagram requests are answered with text-based diagrams. The system prompt explicitly forbids claiming that an image was generated
❌ Voice input Interaction is text and image only
❌ Exam question prediction Question importance analysis is based only on the question papers supplied by the student

Additional practical notes:

  • One image can be attached per message; multiple pages require multiple messages.
  • An active internet connection and a valid Gemini API key are required.
  • AI output can be inaccurate or incomplete. Answers should always be verified against the original material before being relied on for exams.

Future Enhancements

Planned directions, none of which are part of the current implementation:

  • πŸ”Ž Grounded web and video references β€” optional grounding tools so that external verification is actually performed and reported, with the sources shown in the answer
  • πŸ–ΌοΈ Native diagram generation β€” rendered architecture, flow, and process diagrams instead of text-based diagrams
  • πŸ“„ PDF and multi-page document support β€” chapter-level and full-paper analysis
  • πŸ“š Grouped study sets β€” upload several question papers as one set for richer frequency analysis and comparison charts
  • πŸ—‚οΈ Persistent study history β€” database-backed saved sessions and revision notes
  • πŸ‘€ User accounts β€” authentication so study history follows the student across devices
  • πŸ“Š Progress analytics β€” topic coverage and revision tracking dashboards
  • πŸ”Š Voice-based interaction β€” spoken questions and audio explanations
  • πŸ“± WhatsApp / Twilio study reminders β€” scheduled revision nudges (would require a messaging integration and consent flow)
  • 🧾 Export options β€” download generated notes and answers as PDF or Markdown

Documentation

Document Contents
README.md Project overview, features, setup, configuration
docs/ARCHITECTURE.md High-level architecture, request flow, component responsibilities, error handling, security notes
docs/PROJECT_OVERVIEW.md Problem, solution, user journey, scope, roadmap, and suggested repository metadata
assets/architecture/architecture.svg Architecture diagram
assets/screenshots/README.md Screenshot asset naming and capture guidance

License

Released under the MIT License.


Author

Abinesh S β€” github.com/abinesh-0

Built as an AI-assisted learning tool for students preparing for examinations.

About

AI-powered study assistant that analyzes study material, explains concepts, and supports exam-oriented learning with Google Gemini.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages