A powerful, AI-driven tool that "forges" custom interactive Python tutorials. Built using Streamlit, Ngrok, and Qwen2.5-Coder running with 4-bit Quantization for maximum efficiency.
LabSmith is a Client-Server application designed to generate high-quality coding tutorials on demand. It solves the problem of static learning by generating Interactive Jupyter Notebooks (.ipynb) where users can read concepts, see demo code, and solve practice problems with hidden solutions.
The Architecture:
- Local Client: A lightweight Streamlit app acts as the UI on your machine.
- Remote Server: A Kaggle/Colab notebook runs the heavy AI model using GPU acceleration.
- The Bridge: Ngrok securely tunnels the API traffic between the local app and the remote GPU.
- ⚡ 4-bit Quantization: Utilizes
BitsAndBytesto run the powerful Qwen2.5-Coder-7B model on consumer GPUs (like Kaggle P100/T4) with minimal memory usage. - 🔗 Ngrok Tunneling: Seamlessly connects your local machine to a remote cloud GPU, allowing you to run heavy models without local hardware.
- 🧠 Strict JSON Enforcement: Uses deterministic generation strategies to force the LLM to output clean, parseable JSON.
- Interactive Notebook Generation: Automatically compiles the AI output into a
.ipynbfile usingnbformat. - Hidden Solutions: Features HTML
<details>tags to hide answers until the user is ready.
- Frontend UI: Streamlit - For a responsive and easy-to-use web interface.
- AI Model: Qwen2.5-Coder-7B - A state-of-the-art coding LLM optimized for instruction following.
- Inference Engine: Hugging Face Transformers - To load and run the model.
- Optimization: BitsAndBytes - Used for 4-bit quantization to fit the model into limited VRAM.
- Backend API: FastAPI & Uvicorn - To serve the generation endpoint.
- Networking: Ngrok - To create a secure tunnel between the cloud GPU and the local client.
- File Handling: nbformat - To programmatically construct Jupyter Notebooks.
LabSmith-AI/
├── labsmith-ai-server.ipynb # Remote Server (Runs Qwen + Ngrok + 4-bit Quantization)
├── app.py # Local Streamlit Client
├── requirements.txt # Local dependencies
├── README.md # Documentation
│
├── assets/ # Media & visual assets
│ ├── demos # Demo videos
│ └── screenshot # App screenshot
│
├── notebooks/ # Generated tutorial notebooks (.ipynb)
│
└── src/
├── model_utils.py # API connection & validation logic
└── notebook_maker.py # .ipynb compilation logic
- Upload LabSmith-AI_server.ipynb to Kaggle.
- Set the Accelerator to GPU P100 or T4.
- Add your Ngrok Auth Token in the script.
- Run the notebook to start the server.
- Copy the Ngrok URL (e.g., https://xxxx.ngrok-free.app).
git clone [https://github.com/ramaabdelgadir/labsmith-ai.git](https://github.com/ramaabdelgadir/labsmith-ai.git)
cd labsmith-aipip install -r requirements.txtstreamlit run app.py👤 Author Rama Abdelgadir
AI Engenieer | Passionate about efficient LLM deployment and educational tools.
