Solve ยท Learn ยท Understand. Numera solves equations, explains step-by-step, and reads math problems from photos โ built for Matric, Intermediate, and BS students.
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.
- ๐งฎ 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
| 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) |
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.
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
- Clone the repository
git clone https://github.com/Faizan-Ali-00/Math-Problem-Solver.git cd Math-Problem-Solver
- Create a virtual environment
Windows: python -m venv venv venv\Scripts\activate
macOS / Linux: python3 -m venv venv source venv/bin/activate
- Install dependencies
pip install -r requirements.txt
- 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.
| 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 |
- Push to GitHub
git add . git commit -m "Deploy Numera" git push origin main
-
Deploy on Streamlit Cloud
-
Click New app
-
Select your repo: Faizan-Ali-00/Math-Problem-Solver
-
Main file path: app.py
-
Click Deploy
-
Add your API keys as Secrets
Important: Never put API keys in app.py on GitHub โ they become public. Use Streamlit Secrets instead.
- Go to share.streamlit.io โ your app โ โฎ โ Settings
- Click the Secrets tab
- 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"
- Click Save โ Reboot app
Numera has three modes, accessible via tabs:
- Enter an equation or expression (e.g.
xยฒ - 5x + 6 = 0) - Click Solve
- Get the answer, step-by-step explanation, and a diagram
- Enter a math term (e.g.
derivative,matrix,standard deviation) - Click Explain
- Get a full explanation with worked example and diagram
- Take a photo or upload an image of a math question
- Click Solve from Image
- Get the answer, read from the image, with step-by-step solution
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.
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.
- ฯ 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
- 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
- Fork the repository
- Create a feature branch: git checkout -b feature/AmazingFeature
- Commit your changes: git commit -m "Add some AmazingFeature"
- Push to the branch: git push origin feature/AmazingFeature
- Open a Pull Request
This project is licensed under the MIT License.
Faizan Ali GitHub: https://github.com/Faizan-Ali-00 Repository: https://github.com/Faizan-Ali-00/Math-Problem-Solver
If this project helped you, please give it a star on GitHub โ it means a lot!
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