An IBM Internship Project
Transform your ideas into professional LaTeX diagrams with the power of AI
This project is an advanced, AI-powered web application that translates natural language descriptions into complete, compilable, and professional-quality LaTeX diagrams using the TikZ library. Developed as part of an IBM internship program, this tool leverages a modern, cloud-native tech stack to provide a seamless and intuitive user experience.
The application features a conversational chatbot interface where users can describe complex diagrams, such as system architectures, flowcharts, and neural networks, and receive ready-to-use LaTeX code in real-time.
🗣️ Conversational UI: An intuitive chatbot interface for describing diagrams
🧠 Natural Language to Code: Converts plain English descriptions into precise TikZ code
📄 Full Document Generation: Creates complete, runnable .tex
files, including preambles and necessary packages
🔧 Advanced Prompt Engineering: Utilizes a robust prompt structure to ensure the AI defines custom styles and follows LaTeX syntax rules, minimizing errors
☁️ Cloud-Native Deployment: Fully containerized and deployed on IBM's scalable cloud infrastructure
This project was built using a professional-grade, end-to-end technology stack, demonstrating expertise in modern AI and cloud development.
Category | Technology / Service |
---|---|
Cloud Platform | IBM Cloud |
AI Platform | IBM watsonx.ai |
Foundation Model | IBM Granite (Code Instruct) |
Orchestration Framework | LangChain |
Backend Server | Python with Flask |
Production Web Server | Gunicorn |
Frontend UI | HTML5, Tailwind CSS, JavaScript |
Deployment Environment | IBM Code Engine |
Containerization | Docker |
graph TB
A[User Interface] --> B[Flask Backend]
B --> C[LangChain Orchestration]
C --> D[IBM Granite Model]
D --> E[LaTeX Code Generation]
E --> F[TikZ Diagram Output]
G[IBM Code Engine] --> H[Docker Container]
H --> B
I[Environment Variables] --> B
J[GitHub Repository] --> G
The application is deployed as a containerized web service on IBM Code Engine.
- Source Code: The application code is hosted in a GitHub repository
- Containerization: A Dockerfile defines the environment, installing all dependencies and setting up the Gunicorn production server
- Cloud Build & Deploy: IBM Code Engine automatically pulls the source code from GitHub, builds the Docker image, and deploys it as a live application
- Secure Configuration: API keys and Project IDs are managed securely as environment variables within the Code Engine deployment, not hardcoded in the source
LATEX=your_ibm_watsonx_api_key
PROJECT_ID=your_ibm_project_id
- Python 3.8+
- Docker (for containerized deployment)
- IBM watsonx.ai API credentials
-
Clone the repository
git clone https://github.com/yourusername/scholarly-draw.git cd scholarly-draw
-
Install dependencies
pip install -r requirement.txt
-
Set environment variables
set LATEX=your_api_key set PROJECT_ID=your_project_id
-
Run the application
python app.py
-
Access the application Open your browser and navigate to
http://localhost:8080
-
Build the Docker image
docker build -t scholarly-draw .
-
Run the container
docker run -p 8080:8080 -e LATEX=your_api_key -e PROJECT_ID=your_project_id scholarly-draw
Input: "Create a flowchart showing the software development lifecycle"
Output: Complete LaTeX document with TikZ flowchart
Input: "Draw a simple neural network with 3 input nodes, 2 hidden layers, and 1 output node"
Output: Professional TikZ neural network diagram
Input: "Design a microservices architecture diagram with API gateway, databases, and load balancer"
Output: Comprehensive system architecture in LaTeX
scholarly-draw/
├── app.py # Main Flask application
├── DockerFile # Container configuration
├── requirement.txt # Python dependencies
├── index.html # Frontend interface
└── README.md # This file
- AI Integration: Successfully integrated IBM's Granite model with LangChain for sophisticated prompt engineering
- Cloud-Native Design: Built with scalability and production deployment in mind
- Error Handling: Robust error handling and validation for reliable diagram generation
- Professional UI: Clean, responsive interface using modern web technologies
- Security: Secure handling of API credentials through environment variables
The application includes comprehensive testing for:
- API endpoint validation
- LaTeX code generation accuracy
- Error handling scenarios
- Frontend-backend integration
- Support for additional diagram types (UML, ER diagrams, etc.)
- Real-time LaTeX compilation and preview
- Export to multiple formats (PDF, SVG, PNG)
- User authentication and diagram saving
- Collaborative editing features
- Advanced styling options
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- IBM watsonx.ai team for providing access to the Granite foundation model
- IBM Cloud team for the robust deployment infrastructure
- LangChain community for the excellent orchestration framework
- LaTeX and TikZ communities for the powerful diagramming capabilities
Built with ❤️ during IBM Internship Program
Transforming natural language into professional diagrams, one conversation at a time