A lightweight Flask web app that takes the name of a mathematical formula, queries the Ollama model (gemma3:4b), and returns the LaTeX representation of the formula. The result is displayed both as raw LaTeX and as a beautifully rendered formula using MathJax.
- Input a formula name (e.g., Quadratic Formula).
- Model responds with JSON containing the LaTeX expression.
- App extracts and displays:
- Raw LaTeX
- Rendered formula
- Debug-friendly: saves raw model output to
gemma_raw_response.txt.
-
Clone this repository:
git clone https://github.com/YOUR_USERNAME/formula-renderer.git cd formula-renderer -
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows pip install -r requirements.txt
-
Install Ollama and pull the model:
ollama pull gemma3:4b
Run the app:
python app.pyOpen in your browser: π http://127.0.0.1:5000/
- Raw responses from Gemma are saved to
gemma_raw_response.txtfor debugging. - If parsing fails, check that file to inspect the model output.
Made with β€οΈ by Mohammed Shaan