A modern AI image generation application built with Flet and Material Design 3, featuring a beautiful dark green forest theme.
Screenshot showing the AI Image Generator application with its Material Design 3 forest theme
The application is organized into multiple modules for better maintainability and clean separation of concerns:
main.py- Main application entry point and core app logicconfig.py- Configuration constants and Material Design 3 colorsui_components.py- Reusable UI component factories and utilitiesapi_client.py- API client for handling Nebius AI interactionsmaterial-theme.json- Material Design 3 theme configuration
- Material Design 3 Theme: Custom dark green forest theme with proper color tokens
- Responsive UI: Clean, modern interface with shadows and proper spacing
- API Integration: Seamless integration with Nebius AI for image generation
- Secure Storage: API keys stored securely using keyring
- Error Handling: Comprehensive error handling with user-friendly messages
- Modular Architecture: Clean separation of concerns for maintainability
- Install required dependencies using uv:
uv add flet requests keyring openai pillow- Run the application:
uv run python main.pyAlternatively, if you don't have uv installed:
pip install uv
uv sync
uv run python main.py- Configure API Key: Click the settings button and enter your Nebius AI API key
- Enter Prompt: Describe the image you want to generate
- Enhance Prompt (Optional): Use AI to improve your prompt
- Select Size: Choose from predefined sizes or enter custom dimensions
- Generate Image: Click generate and wait for your AI-created image
- Download: Save the generated image to your Downloads folder
The application uses two AI models from Nebius AI:
- Prompt Enhancement:
microsoft/phi-4- Enhances and improves user prompts for better image generation - Image Generation:
black-forest-labs/flux-dev- Generates high-quality images from text prompts
You can customize the app's appearance using Material Design 3 themes:
- Create Custom Theme: Visit Material Theme Builder
- Design Your Theme: Choose your preferred colors and generate a custom theme
- Download: Export and download the
material-theme.jsonfile - Replace: Replace the existing
material-theme.jsonin the project directory - Update Colors: Modify the
MD3Colorsclass inconfig.pyto use your new theme colors
The theme builder allows you to:
- Choose custom seed colors
- Preview light and dark modes
- Generate complete Material Design 3 color schemes
- Export ready-to-use color tokens
- Material Design 3 color tokens
- Application constants and configuration
- Image size mappings and constraints
- API endpoints and model configurations
UIFactory: Factory for creating consistent UI componentsMainViewComponents: Components specific to the main viewSettingsViewComponents: Components for the settings page- Reusable component creation with proper styling
APIClient: Handles all API interactions with Nebius AIMockAPIClient: Mock client for testing purposes- Async operations with proper error handling
- Error categorization for user-friendly messages
ImageGeneratorApp: Main application class- UI creation and management
- Event handling and navigation
- Integration of all modules
To test the module structure:
uv run python test_imports.pyThis will verify all imports work correctly and test basic functionality.
The application uses a custom Material Design 3 theme with:
- Primary: Forest Green (#4A662D)
- Secondary: Muted Olive (#57624A)
- Tertiary: Teal Accent (#386664)
- Surface: Light Green-White (#F9FAEF)
- Error: Standard MD3 Red (#BA1A1A)
This project is licensed under the MIT License.
