How suryanshgupta9933/scene-sense works
Project Type and Purpose
• Scene Sense is a full-stack application that includes a web-based UI (via FastAPI endpoints) and backend processing for image search.
• Key functional areas include AI-powered search (using CLIP), user authentication (with JWT and MongoDB), image storage (on Google Cloud Platform), and embedding management (using Pinecone).
File Structure
• Top-Level Directories and Files:
• The “app” directory contains API endpoint definitions for various user interactions (e.g., home, gallery, login, signup, search, upload).
• The “API” directory holds API modules for core functionalities such as “clip.py” (for interfacing with the CLIP model) and “user_auth.py” (for authentication routines).
• The “cloud” directory handles cloud-related tasks, including storage, indexing, and upload operations (implying integration with Google Cloud Platform).
• The “connections” directory abstracts external service integrations, specifically with GCP, MongoDB, and Pinecone.
• Other files such as “routes.py”, “scene_sense_app.py”, and Docker-related files indicate how services are orchestrated and containerized.
• The “utils” directory contains helper functions such as embeddings calculations, image fetching, and other utilities.
• The “tests” directory is for unit/integration tests ensuring maintainability.
Identifying the Main Components and Their Interactions
a. UI/API Layer:
• Represented by the “app” folder, which houses endpoints (gallery, home, login, signup, search, upload) responsible for handling HTTP requests.
• “routes.py” likely aggregates these endpoints.
b. Core Services / Business Logic:
• The “API” folder is used to encapsulate core processing logic such as interacting with the CLIP model (clip.py) and performing user authentication (user_auth.py).
• These services are triggered by the API layer and in turn handle business logic for search and authentication.
c. Cloud Integration:
• The “cloud” module handles storage (cloud/storage.py), cloud indexing (cloud/index.py), and file uploads (cloud/upload.py). It’s key for image handling and persistent asset storage.
d. External Connections:
• The “connections” directory provides modules for:
• MongoDB for storing user credentials (connections/mongo_db.py)
• Google Cloud Platform integration (connections/gcp.py)
• Pinecone for managing vector embeddings (connections/pinecone.py)
e. Utilities & Testing:
• Utility functions (in “utils”) support image processing, embedding computation, and other helper operations.
• “tests” ensure that major functionalities perform correctly.
Architectural Patterns and Design Principles
• Separation of Concerns: UI routings, API core logic, cloud integrations, and external connection handling are segregated into different modules.
• Microservices/Modular Design: Although the project is a proof-of-concept, its modular file organization supports easier scalability and possible future microservices-like deployments.
• Containerization: The presence of Dockerfiles and docker-compose indicates the use of containerization to achieve consistent deployments.