Lodor commited on
Commit
4009180
1 Parent(s): ff029de

Fix canvas error

Browse files
Files changed (2) hide show
  1. app.py +3 -3
  2. docker-compose.yml +3 -3
app.py CHANGED
@@ -66,7 +66,7 @@ if uploaded_file is not None:
66
 
67
  stroke_width = st.slider("Brush size", 1, 100, 50)
68
 
69
- st.write("Now draw (brush) the part of image that you want to remove.")
70
 
71
  # Canvas size logic
72
  canvas_bg = deepcopy(img_input)
@@ -88,7 +88,7 @@ if uploaded_file is not None:
88
  )
89
 
90
  if canvas_result.image_data is not None:
91
- im = np.array(Image.fromarray(canvas_result.image_data).resize(img_input.size))
92
  background = np.where(
93
  (im[:, :, 0] == 0) &
94
  (im[:, :, 1] == 0) &
@@ -100,7 +100,7 @@ if uploaded_file is not None:
100
  (im[:, :, 2] == 255)
101
  )
102
  im[background]=[0,0,0,255]
103
- im[drawing]=[0,0,0,0] #RGBA
104
 
105
  reuse = False
106
 
 
66
 
67
  stroke_width = st.slider("Brush size", 1, 100, 50)
68
 
69
+ st.write("**Now draw (brush) the part of image that you want to remove.**")
70
 
71
  # Canvas size logic
72
  canvas_bg = deepcopy(img_input)
 
88
  )
89
 
90
  if canvas_result.image_data is not None:
91
+ im = np.array(Image.fromarray(canvas_result.image_data.astype(np.uint8)).resize(img_input.size))
92
  background = np.where(
93
  (im[:, :, 0] == 0) &
94
  (im[:, :, 1] == 0) &
 
100
  (im[:, :, 2] == 255)
101
  )
102
  im[background]=[0,0,0,255]
103
+ im[drawing]=[0,0,0,0] # RGBA
104
 
105
  reuse = False
106
 
docker-compose.yml CHANGED
@@ -1,12 +1,12 @@
1
  ---
2
  version: '3'
3
  services:
4
- st-remove-photo-object:
5
  build: .
6
- container_name: st-remove-photo-object
7
  restart: unless-stopped
8
  ports:
9
- - 51003:8501
10
  volumes:
11
  - .:/app
12
  environment:
 
1
  ---
2
  version: '3'
3
  services:
4
+ sthf-remove-photo-object:
5
  build: .
6
+ container_name: sthf-remove-photo-object
7
  restart: unless-stopped
8
  ports:
9
+ - 41003:8501
10
  volumes:
11
  - .:/app
12
  environment: