Skip to content

Latest commit

ย 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Numera Logo

๐Ÿ“ Numera โ€” Solve Any Math Problem

Solve ยท Learn ยท Understand. Numera solves equations, explains step-by-step, and reads math problems from photos โ€” built for Matric, Intermediate, and BS students.

Python Streamlit Groq Gemini Cerebras OpenRouter License

๐Ÿ“– Overview

Numera is a smart math helper that solves algebraic equations, explains every step, and even reads math problems straight from your camera or photo upload. Built with a multi-provider AI fallback chain, it never leaves you stuck โ€” if one provider fails, the next one instantly takes over.

Perfect for students who want to understand the solution, not just copy it.

โœจ Features

  • ๐Ÿงฎ Solve equations โ€” quadratic, linear, and general expressions
  • ๐Ÿ“– Step-by-step explanations โ€” clear, numbered steps in simple language
  • ๐Ÿ“ท Snap & Solve โ€” take a photo of a math question, get the solution
  • ๐Ÿ“Š Auto diagrams โ€” graphs, circles, triangles, and polygons generated for every problem
  • ๐Ÿ“š History panel โ€” auto-saves last 50 solved problems
  • โš™๏ธ Settings panel โ€” adjustable level, temperature, and token limit
  • ๐ŸŽš๏ธ Three student levels โ€” Matric, Intermediate, BS
  • ๐Ÿ”— Multi-provider fallback โ€” Groq โ†’ Gemini โ†’ Cerebras โ†’ OpenRouter
  • โšก Provider indicator โ€” shows which model answered each question
  • ๐ŸŒˆ Beautiful UI โ€” purple/violet gradient, ฯ€ logo, glassmorphism cards

๐Ÿ› ๏ธ Tech Stack

Layer Technology
Frontend Streamlit
Math Engine SymPy (local, exact answers)
AI Chat (Primary) Groq (openai/gpt-oss-120b)
AI Chat (Fallback 1) Google Gemini Flash
AI Chat (Fallback 2) Cerebras (llama3.1-8b)
AI Chat (Fallback 3) OpenRouter (llama-3.3-70b:free)
Vision (Image Solving) Groq Qwen3.6-27B + Gemini Vision
Diagrams Matplotlib
Language Python 3.10+
Storage Local JSON (history.json, settings.json)

๐Ÿ”— Multi-Provider Architecture

Numera uses a provider chain so it never fails due to a single provider running out of credits:

๐Ÿงฎ Explanation โ†’ 1. Groq (openai/gpt-oss-120b โ€” fastest) โ†“ (fails) 2. Gemini 2.5 Flash โ†“ (fails) 3. Cerebras (llama3.1-8b) โ†“ (fails) 4. OpenRouter (llama-3.3-70b:free) โ†“ (fails) โŒ Error

๐Ÿ“ท Vision โ†’ 1. Groq Qwen3.6-27B (primary) โ†“ (fails) 2. Gemini Vision 2.5 Flash โ†“ (fails) 3. OpenRouter Qwen-VL โ†“ (fails) โŒ Error

You only need one provider key to start, but adding all four means zero downtime.

๐Ÿ“‚ Project Structure

Math-Problem-Solver/ โ”œโ”€โ”€ app.py # Main Streamlit app โ”œโ”€โ”€ solver.py # Core math solver (SymPy) โ”œโ”€โ”€ explainer.py # Multi-provider AI explainer โ”œโ”€โ”€ diagrams.py # Matplotlib diagram generators โ”œโ”€โ”€ requirements.txt # Python dependencies โ”œโ”€โ”€ history.json # Auto-generated โ€” solved problems โ”œโ”€โ”€ settings.json # Auto-generated โ€” saved preferences โ”œโ”€โ”€ logos/ โ”‚ โ””โ”€โ”€ numera.svg # Numera logo (used in README) โ”œโ”€โ”€ .gitignore # Git ignore rules โ””โ”€โ”€ README.md

โš™๏ธ Installation (Local)

  1. Clone the repository

git clone https://github.com/Faizan-Ali-00/Math-Problem-Solver.git cd Math-Problem-Solver

  1. Create a virtual environment

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

macOS / Linux: python3 -m venv venv source venv/bin/activate

  1. Install dependencies

pip install -r requirements.txt

  1. Set up your API keys

Create a .env file in the root directory:

GROQ_API_KEY=gsk_your_groq_key_here GEMINI_API_KEY=AIza_your_gemini_key_here CEREBRAS_API_KEY=csk_your_cerebras_key_here OPENROUTER_API_KEY=sk-or-v1-your_openrouter_key_here

You only need GROQ_API_KEY to start. Add the rest for zero downtime.

๐Ÿ”‘ Getting Free API Keys

Provider Free Tier Get Key
Groq (required) Fast inference, generous free tier https://console.groq.com/keys
Gemini 15 RPM ยท 1,500 req/day https://aistudio.google.com/app/apikey
Cerebras 1M tokens/day ยท 30 req/min https://cloud.cerebras.ai/
OpenRouter 50 req/day ยท 20+ free models https://openrouter.ai/keys

๐Ÿš€ Deployment (Streamlit Cloud)

  1. Push to GitHub

git add . git commit -m "Deploy Numera" git push origin main

  1. Deploy on Streamlit Cloud

  2. Go to https://share.streamlit.io/

  3. Click New app

  4. Select your repo: Faizan-Ali-00/Math-Problem-Solver

  5. Main file path: app.py

  6. Click Deploy

  7. Add your API keys as Secrets

Important: Never put API keys in app.py on GitHub โ€” they become public. Use Streamlit Secrets instead.

  1. Go to share.streamlit.io โ†’ your app โ†’ โ‹ฎ โ†’ Settings
  2. Click the Secrets tab
  3. Paste your keys:

GROQ_API_KEY = "gsk_your_groq_key_here" GEMINI_API_KEY = "AIza_your_gemini_key_here" CEREBRAS_API_KEY = "csk_your_cerebras_key_here" OPENROUTER_API_KEY = "sk-or-v1-your_openrouter_key_here"

  1. Click Save โ†’ Reboot app

โ–ถ๏ธ Usage

Numera has three modes, accessible via tabs:

๐Ÿงฎ Solve a Problem

  1. Enter an equation or expression (e.g. xยฒ - 5x + 6 = 0)
  2. Click Solve
  3. Get the answer, step-by-step explanation, and a diagram

๐Ÿ“– Understand a Definition

  1. Enter a math term (e.g. derivative, matrix, standard deviation)
  2. Click Explain
  3. Get a full explanation with worked example and diagram

๐Ÿ“ท Snap & Solve

  1. Take a photo or upload an image of a math question
  2. Click Solve from Image
  3. Get the answer, read from the image, with step-by-step solution

๐ŸŽ›๏ธ Settings

Open the โš™๏ธ Settings tab in the sidebar to configure:

Setting Options Default
Level Matric / Intermediate / BS Matric
Temperature 0.0 โ€“ 1.0 0.3
Max Tokens 500 โ€“ 3000 1500

Click Save Settings to persist them. Click Reset to Defaults to restore original values.

๐Ÿ“š History

Every problem you solve is automatically saved in the ๐Ÿ“š History tab (up to the last 50). Each entry includes:

  • ๐Ÿ• Timestamp
  • ๐Ÿ“ Original question
  • โœ… Answer preview
  • ๐ŸŽš๏ธ Student level

You can View, Delete individual entries, or Clear All at once.

๐ŸŽจ UI Highlights

  • ฯ€ in a circle logo โ€” purple/violet/pink gradient, glowing
  • ๐ŸŒˆ Modern gradient โ€” cool, elegant, distraction-free
  • ๐Ÿ’ฌ Glassmorphism cards โ€” soft transparency, purple borders
  • ๐Ÿ“Š Auto diagrams โ€” Matplotlib graphs embedded inline
  • โšก Provider badge โ€” shows which AI model answered
  • ๐Ÿ“Œ Sidebar โ€” three tabs: Solve, History, Settings

๐Ÿ”’ Security Notes

  • Never commit .env to GitHub
  • Always use Streamlit Secrets for deployed apps
  • Revoke keys immediately if accidentally exposed
  • Store each provider's key separately for easy rotation
  • On Streamlit Cloud, history.json is wiped on reboot

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/AmazingFeature
  3. Commit your changes: git commit -m "Add some AmazingFeature"
  4. Push to the branch: git push origin feature/AmazingFeature
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ‘ค Author

Faizan Ali GitHub: https://github.com/Faizan-Ali-00 Repository: https://github.com/Faizan-Ali-00/Math-Problem-Solver

โญ Show Your Support

If this project helped you, please give it a star on GitHub โ€” it means a lot!

๐Ÿ™ Acknowledgments

Groq โ€” https://groq.com Google Gemini โ€” https://ai.google.dev Cerebras โ€” https://cerebras.ai OpenRouter โ€” https://openrouter.ai Streamlit โ€” https://streamlit.io SymPy โ€” https://sympy.org

About

I๐Ÿ“ Numera โ€” Multi-provider AI math solver that solves equations, explains step-by-step, and reads problems from photos. Built with Python, Streamlit, and SymPy.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages