How suraj-5556/cat_vs_dog_classifer works
Project type and purpose
• This is a lightweight ML‐powered web application built with Streamlit. It serves a pre-trained CNN model (cat_dog_model.keras) to classify user-uploaded images as cats or dogs in real time. The Jupyter notebook (cnn_source.ipynb) and dataset link support offline model training.
File structure
• .devcontainer/ : Defines a VS Code dev container (container.json) for consistent dev environment.
• README.md : Describes the app’s purpose and tech stack.
• requirements.txt : Lists Python dependencies (streamlit, tensorflow/keras, pillow, etc.).
• cat_vs_dog.py : Entry point—Streamlit app that loads the model, handles uploads, runs inference, and displays results.
• cat_dog_model.keras : Serialized CNN model used at runtime.
• cnn_source.ipynb : Notebook used for data exploration, model architecture design, training, and saving the model.
• dataset link : External pointer (e.g., Kaggle) to the raw image dataset.
README for additional insights
• Confirms that Streamlit is used for the front end (UI) and that inference is real-time.
• Implies TensorFlow/Keras as the model framework.
Main components and interactions
a. User Interface (Streamlit App)
• Component: cat_vs_dog.py running inside a Streamlit server.
• Responsibility: accepts image uploads, displays confidence scores, and shows classification.
b. Model Inference Service
• Component: TensorFlow/Keras runtime inside the same process or a separate microservice.
• Loads cat_dog_model.keras, applies image preprocessing (resize, normalize), and performs predict().
c. Model Storage
• Component: Persistent storage (local file system or blob storage) holding cat_dog_model.keras.
d. Training Pipeline (offline)
• Component: Jupyter notebook (cnn_source.ipynb) plus dataset fetched via “dataset link.”
• Workflow: Load images → preprocess → define and train CNN → serialize model to cat_dog_model.keras.
e. Development Environment
• Component: .devcontainer config ensuring consistent dependencies in Docker/VS Code.
Architectural patterns and design principles
• Separation of concerns: distinct “training” vs. “inference” workflows.
• Single-page application: Streamlit handles both front end and back end logic.
• Model versioning: store the .keras file separately so it can be swapped or updated without changing app code.
• Containerization/dev container: ensures reproducible environment for contributors.
Key diagramming recommendations
• Both the runtime (inference) and development (training, environment) contexts for completeness.
• Keep it simple: focus on the four or five core blocks (User, Streamlit App, Inference, Model Storage, Training Notebook) and their interactions.