Created the app/__init__.py for adding the backend code inside the app directory
Created the app/routes.py for adding the view functions
Exported the FLASK_APP=main.py to the environment
Tested the execution of the flask app by flask run command
Installed the python dot env for saving the environment variables, helpful for using environment variable and to install use uv pip install python-dotenv
Created the .flaskenv for storing the environmental variables for this application
Created a directory named app/templates
Inside the app/templates/ directory, created the index.html
By using the render_template() function the html code is rendered in the webpage.
Can able to add title arg in the render_template() as it is optional and html contains the {% if title %} and {% else %} and {% endif %} for conditional rendering.
Created a base template in base.html that acts as layout.jsx in react based applications.
Updated the app/templates/index.html with the block named content
To make the active reload of the flask app, run with flask run --debug command
Created app/static folder for storing the css files
Splitted the base.html into multiple files like main.html, navbar.html and footer.html
Backend logic implementation
Added the file upload logic to the routes.py and updated the main.html for previewing the file
Added the cards in the main html file for uploading the image, previewing the image and getting the result image.
Downloaded the SAM 2 model from the sam2 github repository
Inference code is added to get the final result
For better user experience overlay image is added in the preview_image() function