How ushasreddy060626/ai-powered-latex-diagram-generator works
This is a Streamlit application that turns natural-language descriptions (and experimentally, sketches) into downloadable TikZ diagrams. The main workflow runs from user input through example retrieval and AI generation, then LaTeX compilation, repair, and preview; users can refine, undo, and export results. The graph preserves the README’s documented capabilities, while source-level evidence is limited to rag.py and kb_examples.py; relationships documented but not verified in sampled implementation are cited to the README.
Main entry points: app.py Streamlit Interface · tikz_agent.py Diagram Agent · rag.py Similarity Retrieval · kb_examples.py Verified TikZ Examples
Components 14
User Interface
- Streamlit Interface
app.py - Sketch Input
app.py - Refine and Undo
app.py
Example Retrieval
- Verified TikZ Examples
kb_examples.py - Similarity Retrieval
rag.py - Embedding Service
Diagram Generation
- Diagram Agent
tikz_agent.py - Granite Text Model
- Vision Model
Compile and Export
- TikZ Compiler
tikz_agent.py - pdflatex
- PDF Preview
tikz_agent.py - PDF and TikZ Export
app.py
Other components
- Diagram Author
Connections 17
- Diagram Author → Streamlit Interface: describes diagram
README.md - Diagram Author → Sketch Input: uploads sketch
README.md - Streamlit Interface → Sketch Input: routes upload
README.md - Sketch Input → Vision Model: interprets sketch
README.md - Streamlit Interface → Diagram Agent: requests generation
README.md - Diagram Agent → Similarity Retrieval: retrieves examples
README.md - Similarity Retrieval → Embedding Service: embeds query
rag.py - Similarity Retrieval → Verified TikZ Examples: embeds descriptions
rag.py - Diagram Agent → Granite Text Model: generates TikZ
README.md - Diagram Agent → TikZ Compiler: compiles code
README.md - TikZ Compiler → pdflatex: runs compiler
README.md - TikZ Compiler → Granite Text Model: requests repair
README.md - TikZ Compiler → PDF Preview: converts PDF
README.md - Streamlit Interface → Refine and Undo: accepts instructions
README.md - Refine and Undo → Diagram Agent: modifies diagram
README.md - Streamlit Interface → PDF and TikZ Export: offers downloads
README.md - PDF Preview → Streamlit Interface: displays preview
README.md