Modern Multi-Modal LLM Web Application
A modern, production-ready web application for AI-powered image analysis, converted from Python Gradio to Next.js TypeScript with dual AI provider support.
- Upload interior design images for detailed analysis
- Get insights on design style, color schemes, materials, and furniture
- Ask follow-up questions for deeper analysis
- Perfect for interior designers and homeowners
- Process multiple receipt images simultaneously
- Extract key information like totals, items, and dates
- Calculate summary totals across multiple receipts
- Ideal for expense tracking and accounting
- Convert charts, graphs, and visualizations to HTML tables
- Extract data points from visual representations
- Export structured data for further analysis
- Useful for data analysis and reporting
- Frontend: Next.js 14+ with TypeScript
- Styling: Tailwind CSS
- File Upload: react-dropzone
- AI Providers: Llama 3.2 Vision & Gemini 1.5 Flash
- Image Processing: Sharp (server-side)
- Type Safety: Full TypeScript implementation
- Frontend: Gradio web interface
- AI Model: Llama 3.2 Vision (90B) via Together AI
- Backend: Python 3.10+
- Dependencies: PyTorch, NumPy, Matplotlib
The Next.js application supports multiple AI providers with intelligent fallback:
- Llama 3.2 Vision (via Together AI) - Primary provider for multimodal analysis
- Gemini 1.5 Flash (via Google AI) - Fallback provider with excellent vision capabilities
- Automatic Selection: The app chooses the best available provider based on your configuration
- Smart Fallback: If the primary provider fails, it automatically tries the fallback provider
- Provider Priority: Configure which provider to try first via
AI_PROVIDER_PRIORITY - Real-time Status: See which provider is being used in the UI
-
Navigate to the Next.js app:
cd multimodal-llm-nextjs -
Install dependencies:
npm install
-
Configure environment variables: Create
.env.localwith your API keys:# AI Provider Configuration TOGETHER_API_KEY=your_together_api_key_here DLAI_TOGETHER_API_BASE=https://api.together.xyz GEMINI_API_KEY=your_gemini_api_key_here # Optional APIs WOLFRAM_ALPHA_KEY=your_wolfram_alpha_key_here TAVILY_API_KEY=your_tavily_api_key_here # Provider Priority (comma-separated: llama,gemini or gemini,llama) AI_PROVIDER_PRIORITY=llama,gemini
-
Run development server:
npm run dev
Open http://localhost:3000 in your browser.
-
Navigate to Python lessons:
cd MultiModal_LLamaLesson -
Create virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run Python app:
python app.py
MultiModalLLM/
βββ π± Next.js Implementation
β βββ multimodal-llm-nextjs/
β βββ src/
β β βββ app/api/ # API routes
β β βββ components/ # React components
β β βββ lib/ # AI provider logic
β β βββ types/ # TypeScript definitions
β βββ package.json
β βββ README.md
β
βββ π Python Implementation
β βββ MultiModal_LLamaLesson/
β βββ app.py # Main Gradio app
β βββ utils.py # Utility functions
β βββ requirements.txt
β
βββ ποΈ Other Projects
β βββ MemoryLaneHK/ # Memory Lane HK project
β βββ kiddrawai/ # Kid Draw AI project
β βββ Experiment/ # Experimental code
β
βββ π Main Files
βββ app.py # Original Gradio app
βββ requirements.txt # Python dependencies
βββ utils.py # Shared utilities
POST /api/interior-design- Analyze interior design imagesPOST /api/receipts- Process multiple receipt imagesPOST /api/graph-to-table- Convert graphs to HTML tablesGET /api/providers- Get available provider information
- Interior Design Tab: Upload images, select AI provider, get detailed analysis
- Receipts Tab: Upload multiple receipts, get itemized and summary totals
- Graph to Table Tab: Convert charts to structured HTML tables
- Provider Selection: Switch between Llama and Gemini or let the app choose automatically
- Navigate to specific tabs in the Gradio interface
- Upload images using the file upload component
- Use default prompts or customize your questions
- Get AI-powered analysis results
- Vercel (recommended): Connect your GitHub repository
- Netlify: Deploy with environment variables
- Railway: Full-stack deployment with database support
- Gradio Cloud: Direct deployment from Python code
- Hugging Face Spaces: Free hosting for Gradio apps
- Local: Run with
python app.py
AI_PROVIDER_PRIORITY=llama,gemini- Prefer Llama firstAI_PROVIDER_PRIORITY=gemini,llama- Prefer Gemini first- Configure only one API key to use a single provider
11B-Vision-Instruct-Turbo(default)90B-Vision-Instruct-Turbo(for better performance)
- Together AI: For Llama 3.2 Vision model access
- Google AI: For Gemini 1.5 Flash model access
- Optional: Wolfram Alpha API key for mathematical computations
| Feature | Next.js | Python/Gradio |
|---|---|---|
| UI/UX | Modern React components | Gradio interface |
| Type Safety | Full TypeScript | Python typing |
| Deployment | Vercel, Netlify | Gradio Cloud, HF Spaces |
| AI Providers | Dual provider support | Single provider |
| Performance | Optimized builds | Python runtime |
| Customization | Highly customizable | Gradio limitations |
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Open a Pull Request
This project is open source and available under the MIT License.
- Together AI for providing access to Llama 3.2 Vision models
- Google AI for Gemini API access
- Next.js team for the excellent React framework
- Gradio team for the Python interface framework
- Meta for developing the Llama model family
For questions and support:
- Create an issue on GitHub
- Contact: aibyml.org@gmail.com
Built with β€οΈ using Claude Code