Download weights from Google Drive
gdown --id 1EDUARyROWS1yUbqTcZ0AhJ7K-31M9MZk
unzip weight.zip
Manually from bash https://drive.google.com/file/d/1EDUARyROWS1yUbqTcZ0AhJ7K-31M9MZk/view?usp=drive_link
Create Virtual Environment
conda create --name artdetector python=3.8
conda activate artdetector
Install Dependencies
pip install -r requirements.txt
Run Flask program
python application.py
Run Browser to test segmentation
http://127.0.0.1:5000
Choose your image and click the Upload button
Wait until you get the segmented output
Click the ReTake Button to test new images
URL: http://127.0.0.1:5000/detectart
OPEN POSTMAN: POST body
{
"image":"<base64 image>"
}
docker build -t <your_tag> .
docker container run -p 5001:5000 <your_tag>
Flask app.
│ application.py
│ src
│ README.md
│ requirements.txt
│
├───.ebextensions
│ packages.config
│ python.config
│
├───.platform
│ └───nginx
│ └───conf.d
│ upload_size.conf
│
├───templates
│ index.html
│ output.html
|───weights
NOTE: The name of your main flask app must be application.py
- Create a folder name .ebextensions
- Create file packages.config name and paste the following lines
commands:
install_mesa:
command: yum install mesa-libGL -y
The above command install libGL library which is required for OpenCV and rembg
- Create file python.config
option_settings:
"aws:elasticbeanstalk:container:python":
WSGIPath: application:application
- Create folder name .platform/nginx/conf.d and file .platform/nginx/conf.d/upload_size.conf
client_max_body_size 20M;
proxy_read_timeout 3000;
proxy_connect_timeout 3000;
proxy_send_timeout 3000;
client_max_body_size: proxy_read_timeout: proxy_connect_timeout: proxy_send_timeout:
- Open Elastic BeanStalk
- Click Create environment Fill Following Information:
Application Information Application name: Artdetector
Platform platform: Python platform branch: Python 3.8 platform version: 3.5.3
Application code Upload your code Version label: ver-1 Local file: Upload application (Choose File)
Presents: Single instance
Click Next
- Service role:
- Create and use new service role
EC2 key pair: - Select your keys
EC2 instance profile: -
Create role with name: aws-elasticbeanstalk-ec2-role Goto: IAM > Roles > Create role Add Permission details:
AWSElasticBeanstalkEnhancedHealth
AdministratorAccess-AWSElasticBeanstalk
AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy
Click Next
- Configure instance traffic and scaling
Instance settings: Public IP address: tick: Activated
Click Next
Add EC2 Security groups: Enable Port 5000 - 5005
Auto scaling group: Select your environment type: Single Instance or Load Balance
Select instance t3.x2large, t3.xlarge
Click Next
- Configure updates, monitoring, and logging Rolling updates and deployments: Command timeout: 3500
Click Next
- Submit