Here's a README.md file for your code:
I always wanted to change the background of my picture without uploading them online so i tried writing a code to that for me. This is a Streamlit web application for changing the background of an person image. It allows users to upload an image containing a person, select a background from predefined options, and then removes the person from the foreground image and blends it with the selected background.
To run this application locally, follow these steps:
- Clone this repository:
git clone https://github.com/AbdullahMansoor123/image_background_changer
- Navigate to the cloned directory:
cd image_background_changer
- Install the required dependencies:
pip install -r requirements.txt
- Download the YOLO model weights file
yolov8n-seg.pt
and place it in the project directory.
After setting up the environment, you can run the Streamlit app using the following command:
streamlit run streamlit_app.py
Once the application starts, follow these steps:
- Upload an image containing a person using the file uploader.
- Select a background from the dropdown menu.
- Click the "Download" button to save the processed image with the new background.
app.py
: Python script containing the Streamlit application code.requirements.txt
: File listing the Python dependencies required to run the application.yolov8n-seg.pt
: YOLO model weights file for person segmentation.backgrounds/
: Directory containing background images.
ultralytics
: Python library for YOLO object detection.streamlit
: Python library for creating web applications.Pillow
: Python Imaging Library for image processing.opencv-python
: OpenCV library for image manipulation.numpy
: Library for numerical computing.
Click here to check my -->Streamlit App