Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ppiova/aivision-background-removal
Background Removal
https://github.com/ppiova/aivision-background-removal
Last synced: 10 days ago
JSON representation
Background Removal
- Host: GitHub
- URL: https://github.com/ppiova/aivision-background-removal
- Owner: ppiova
- Created: 2023-08-26T23:17:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-27T14:03:56.000Z (over 1 year ago)
- Last Synced: 2025-01-05T01:15:23.457Z (10 days ago)
- Language: Jupyter Notebook
- Homepage:
- Size: 5.96 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Background Removal with Azure AI Vision and Gradio
![Example image](https://github.com/ppiova/AIVision-ImageRetrieval/blob/main/images/Gradio-RemovalBackground.gif "GradioDemmo")
This Jupyter Notebook uses Azure Computer Vision to remove the background from images and visualizes the results using a Gradio web interface. Users can upload an image through the Gradio interface, and the service will return the image with the background removed as well as a mask of the object.
## Requirements
- Python 3.6+
- Azure Subscription
- Azure Computer Vision Service
- Jupyter Notebook## Installation
1. **Clone the repository**
```bash
git clone https://github.com/YourRepo/YourProject.git
```
2. **Change to project directory**
```bash
cd YourProject
```3. **Install the required packages**
```bash
pip install gradio
pip install requests
pip install python-dotenv
pip install pillow
```4. **Set Environment Variables**
Create an `.env` file in the root folder named `azure.env`. In this file, set your Azure AI Vision API key and endpoint:
```
azure_cv_key=YOUR_AZURE_CV_KEY
azure_cv_endpoint=YOUR_AZURE_CV_ENDPOINT
```## Running the Web App in Jupyter Notebook
1. **Open the Jupyter Notebook file (`your_notebook_name.ipynb`).**
2. **Navigate to the cell that contains the Gradio web interface code.**
3. **Run the cell to launch the Gradio web interface.**A URL will appear in the output section below the cell. Click on it to access the web interface.
## Code Structure
- `post_request`: Function for sending POST requests to Azure.
- `remove_background_from_image`: Main function to remove background from an image.
- **Gradio UI in Jupyter Notebook**: Code to set up the Gradio web interface within the notebook.## Sample Images
You can use the sample images (`piova-01.jpg`, `piova-02.jpg`, etc.) provided in the `images` directory to test the background removal.
## Sample Images
You can use the sample images (`piova-01.jpg`, `piova-02.jpg`, etc.) provided in the `images` directory to test the background removal.
## Additional Resources
For more code examples and use-cases, you can check out the following repositories:
1. **Removing Background Using Azure Computer Vision by Serge Retkowsky**
This repository can serve as an additional resource for enhancing and expanding your projects in Python.
[View Repository](https://github.com/retkowsky/Removing-background-using-Azure-Computer-Vision-4)2. **Azure ComputerVision BackgroundRemoval in .NET by Ppiova**
This repository provides a .NET implementation for removing background using Azure Computer Vision. Feel free to utilize it in your .NET projects.
[View Repository](https://github.com/ppiova/Azure-ComputerVision-BackgroundRemoval)