How heychhavi/fashion-ai-assistant works
Project Type and Purpose
• The project is a full-stack, AI-driven personal styling assistant. Its main purpose is to analyze users’ style preferences through image analysis (using Google’s Gemini 1.5 Flash model) and to integrate with Shopify for product recommendations and purchases.
• The README provides an overview of the intelligent styling recommendations, while the file tree shows the main Python scripts and configurations (e.g., app.py, shopify_client.py, style_analyzer.py) that implement the different functional layers.
Analyzing the File Structure
• Key Files:
• app.py: Serves as the entry point and likely runs the Streamlit-based user interface.
• shopify_client.py: Handles Shopify API communications.
• style_analyzer.py: Integrates with AI (Gemini API) for image-based style analysis.
• create_dummy_products.py & dummy_products.json: Used to simulate and test Shopify product data during development.
• test_shopify_updated.py: Contains testing routines for validating Shopify-related functionalities.
• Configuration and Environment:
• .env.example outlines crucial environment variables like API keys and store credentials.
• .devcontainer folder indicates support for development containerization.
• Supplementary Documents:
• README.md, SHOPIFY_SETUP.md, and SYNOPSIS.md provide further setup instructions and system usage details.
Key Architectural Components
a. User Interface Layer:
• Implemented via Streamlit (app.py) which handles:
• Image uploads.
• Preference inputs.
• Displaying recommendations.
b. Application (Business Logic) Layer:
• Central coordination of style analysis, recommendation generation, and cart management.
• Likely split between app.py and integrated modules such as style_analyzer.py.
c. Service Integration Layer:
• Consists of API-specific components:
• shopify_client.py: Handles real-time e-commerce integration with Shopify.
• style_analyzer.py: Communicates with the Gemini AI API for visual analysis.
• create_dummy_products.py supports generating test data for developing product features.
d. External Services:
• Google Gemini API: For advanced image processing and style recognition.
• Shopify Storefront/Access APIs: For fetching product catalogs, pricing, availability, and cart functionalities.
• Possible additional external storage or session management services for image data.
Relationships and Data Flow
• User actions (image uploads and preference selections) in the Streamlit UI.
• The UI sending data to the Application Logic.
• The Application Logic invoking the style analysis module, which then calls the external Gemini API.
• Once the style analysis is complete, the system generates recommendations and uses the shopify_client module to fetch product data from Shopify.
• The products are then shown back in the UI with options for quick purchase.
Architectural Patterns and Design Principles
• Separation of Concerns:
• UI (presentation) is decoupled from business logic and service integrations.
• Modularity:
• Dedicated modules for Shopify API interactions and style analysis.
• Environment-based Configuration:
• Usage of environment variables and containerization (.env file and .devcontainer) for consistent development and deployment setups.
• Testing:
• Inclusion of test modules (e.g., test_shopify_updated.py) to ensure quality and reliability in integrations.