A modern Gradio web application that leverages Google Gemini AI to generate personalized clothing recommendations based on user profile data. The app analyzes body shape, height, gender, and clothing size to provide actionable styling advice with outfit suggestions, fit tips, color guidance, and quick styling tricks.
- AI-Powered Recommendations: Uses Google Gemini 2.5 Flash model for intelligent, context-aware styling advice
- Light & Dark Mode: Fully responsive UI with automatic theme detection and manual toggle
- Real-Time Generation: Instant clothing recommendations with structured advice sections
- Example Profiles: Pre-loaded sample inputs for quick testing and exploration
- Input Validation: Graceful error handling with user-friendly feedback messages
- Production-Ready: Environment-based configuration for secure API key management
- Modern UI/UX: Clean, intuitive interface with gradient styling and smooth interactions
- Cross-Platform: Works on Windows, macOS, and Linux
Input your profile:
- 👤 Gender (Male, Female, Non-binary)
- 👗 Body Shape (Hourglass, Pear, Rectangle, Apple, Inverted Triangle, Athletic, Round)
- 📏 Height (cm or feet format)
- 📐 Clothing Size (XS to XXL)
Get personalized styling guidance:
- Best Outfit Ideas - Tailored suggestions matching your body type
- Fit & Silhouette Tips - How to flatter your unique shape
- Color & Pattern Suggestions - Shades and prints that enhance your look
- Quick Styling Tip - One actionable advice you can use immediately
| Component | Technology |
|---|---|
| Frontend | Gradio 4.44.0+ |
| Backend | Python 3.11 |
| AI Model | Google Gemini 2.5 Flash |
| API Client | google-generativeai 0.3.2+ |
| Web Framework | Gradio Blocks |
Before you begin, ensure you have the following:
- Python 3.11+ installed on your system
- pip or conda package manager
- Google Gemini API Key (Get one free here)
git clone https://github.com/StreetCoder02/Clothing-Recommendation-app.git
cd Clothing-Recommendation-apppython3 -m venv .venv
source .venv/bin/activatepython -m venv .venv
.venv\Scripts\activatepip install -r requirements.txtCreate a .env file in the project root (use .env.example as a template):
cp .env.example .envThen edit .env and add your Google Gemini API key:
GEMINI_API_KEY=your_api_key_here
Alternatively, set it as an environment variable:
export GEMINI_API_KEY="your_api_key_here" # macOS/Linux
set GEMINI_API_KEY=your_api_key_here # Windows CMDpython Clothing_Gradio.pyThe app will start at http://127.0.0.1:7860
GRADIO_SERVER_PORT=8080 python Clothing_Gradio.pysource .venv/bin/activate # or .venv\Scripts\activate on Windows
python Clothing_Gradio.py- Fill Your Profile: Select or enter your gender, body shape, height, and clothing size
- Click "Generate Recommendations": Wait for AI to process your profile
- Read Your Styling Tips: Get personalized outfit and color suggestions
- Try Examples: Click the example profiles to see how the app works
- Toggle Theme: Use the 🌙 Dark Mode button to switch between light/dark modes
- ✨ Female, Hourglass, 168 cm, Size M
- 💼 Male, Rectangle, 5'10", Size L
- 🎭 Non-binary, Pear, 160 cm, Size S
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY |
✅ Yes | Your Google Gemini API key |
GRADIO_SERVER_PORT |
❌ Optional | Port number (default: 7860) |
PORT |
❌ Optional | Alternative port variable for deployment |
- Create a new Space on Hugging Face
- Select Gradio as the Space SDK
- Upload your repository files
- Add
GEMINI_API_KEYto Repository Secrets - Set
Clothing_Gradio.pyas the entry point - Your app will deploy automatically!
The app works on any Python hosting platform:
- Railway.app - Set environment variables in dashboard
- Heroku - Add
Procfilewithweb: python Clothing_Gradio.py - Render - Add deploy configuration in dashboard
- AWS Lambda - Package with serverless framework
- Docker - See Docker deployment section below
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENV GEMINI_API_KEY=""
ENV GRADIO_SERVER_PORT=7860
EXPOSE 7860
CMD ["python", "Clothing_Gradio.py"]docker build -t styleme-ai .
docker run -e GEMINI_API_KEY="your_key" -p 7860:7860 styleme-aiClothing-Recommendation-app/
├── Clothing_Gradio.py # Main application entry point
├── requirements.txt # Python dependencies
├── runtime.txt # Python version specification
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules
└── README.md # This file
The app uses a sophisticated system prompt that:
- Establishes Context: Frames the AI as an expert fashion stylist
- Profiles the User: Analyzes body type, height, and size data
- Structures Output: Requests specific sections (outfits, fit, colors, tips)
- Ensures Tone: Keeps advice respectful, practical, and actionable
User Input → Validation → Prompt Generation → Gemini API Call → Response Processing → Display Output
Edit line 13 in Clothing_Gradio.py:
MODEL_NAME = "gemini-2.5-flash" # Change to other modelsAvailable models: gemini-pro, gemini-1.5-flash, gemini-1.5-pro
Edit the body shape dropdown in Clothing_Gradio.py:
body_shape = gr.Dropdown(
["Your", "Custom", "Shapes", "Here"],
label="Body Shape"
)APP_TITLE = "Your Custom Title"
APP_SUBTITLE = "Your custom subtitle here"- API Rate Limiting: Google Gemini has usage limits (check your plan)
- Deprecated Library:
google-generativeaiis deprecated; consider migrating togoogle-genaiin future - Cold Start: First request may take 2-3 seconds
- Internet Required: Cannot work offline (requires API connection)
Contributions are welcome! Here's how:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to 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.
- 📖 Gradio Docs: https://gradio.app/docs
- 🤖 Google Gemini API: https://ai.google.dev/
- 🐛 Report Issues: Open an issue on GitHub
- 💬 Discussions: Start a discussion for questions
- Gradio - Beautiful web UI framework
- Google AI Studio - Gemini API access
- Python - Amazing programming language
Made with ❤️ for fashion enthusiasts and tech lovers
⭐ Star this repo if you found it helpful!