A beautiful web application that allows users to upload files and get AI-powered analysis using AI model. Built with Flask and featuring a modern, responsive UI with drag-and-drop functionality. Here I have used google gemini ai model, let's see how you can do that too.
- 🎨 Modern UI - Beautiful gradient design with glassmorphism effects
- 📁 Drag & Drop Upload - Intuitive file upload with drag-and-drop support
- 🤖 AI Analysis - Powered by Google's Gemini 2.0 Flash model
- 📱 Responsive Design - Works seamlessly on desktop and mobile
- ⚡ Real-time Feedback - Loading animations and instant results
- 🔍 File Support - Supports images, documents, videos, and more
- 💬 Custom Prompts - Add custom instructions for AI analysis
Upload any file and get instant AI-powered insights:
- Image analysis and description
- Document summarization
- Code review and explanation
- Data analysis from spreadsheets
- Video content analysis
- And much more!
- Python 3.8 or higher
- Google AI API key (Gemini)
-
Clone the repository
git clone https://github.com/shohagcsediu/Document-Chatbot.git cd Document-Chatbot -
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
Create a
.envfile in the root directory:GOOGLE_API_KEY=your_gemini_api_key_here PORT=5000
-
Get your Gemini API key
- Visit Google AI Studio
- Create a new API key
- Add it to your
.envfile
python app.pyThe app will be available at http://localhost:5000
Document Chatbot/
├── app.py # Main Flask application
├── templates/
│ └── upload.html # Beautiful UI template
├── screenshots/ # Screenshots for README
│ ├── screenshot1.png
│ ├── screenshot2.png
│ └── screenshot3.png
├── requirements.txt # Python dependencies
├── .env # Environment variables (create this)
├── .gitignore # Git ignore file
└── README.md # This file
Beautiful gradient design with drag-and-drop file upload area
Loading animation while Gemini AI processes the uploaded file
AI-generated analysis displayed in a clean, readable format
- Start the application
- Open your browser and navigate to
http://localhost:5000 - Upload a file by clicking or dragging and dropping
- Add a custom prompt (optional) to guide the AI analysis
- Click "Analyze" and wait for results
- View the AI-generated analysis in the response section below
GET /- Serves the main upload interfacePOST /upload- Handles file upload and AI analysisGET /health- Health check endpoint
{
"filename": "example.pdf",
"content_type": "application/pdf",
"gemini_response": "AI analysis of the uploaded file..."
}- Gradient Background - Modern purple gradient design
- Glassmorphism Effects - Semi-transparent containers with backdrop blur
- Interactive Elements - Hover effects and smooth transitions
- Loading States - Spinner animation during processing
- Error Handling - Clear error messages with visual feedback
- File Information - Display file details (name, size, type)
- Mobile Responsive - Optimized for all screen sizes
- Never commit your
.envfile to version control - Keep your Google API key secure and rotate it regularly
- Consider implementing file size limits for production use
- Add input validation for enhanced security
- Flask 3.0.0 - Web framework
- google-generativeai 0.3.2 - Google's Gemini AI SDK
- python-dotenv 1.0.0 - Environment variable management
- gunicorn 21.2.0 - WSGI server for production
- Werkzeug 3.0.1 - Flask's WSGI toolkit
- 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.
- Google for the powerful Gemini AI model
- Flask community for the excellent web framework
- Contributors who help improve this project
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include error messages and steps to reproduce
⭐ Star this repository if you found it helpful!
Made with ❤️ by Shohag