itacaiunas
commited on
Commit
·
6541d18
1
Parent(s):
2e32e4e
Update app.py
Browse files
app.py
CHANGED
@@ -19,13 +19,13 @@ def image_download_button(pil_image, filename: str, fmt: str, label="Download"):
|
|
19 |
raise Exception(f"Unknown image format (Available: {fmt} - case sensitive)")
|
20 |
|
21 |
pil_format = "JPEG" if fmt == "jpg" else "PNG"
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
mime = "image/png"
|
26 |
|
27 |
buf = BytesIO()
|
28 |
-
pil_image.save(buf, format=
|
|
|
29 |
|
30 |
|
31 |
return st.download_button(
|
@@ -102,7 +102,7 @@ if uploaded_file is not None:
|
|
102 |
(im[:, :, 1] == 0) &
|
103 |
(im[:, :, 2] == 255)
|
104 |
)
|
105 |
-
im[background] = [0, 0, 0,
|
106 |
im[drawing]=[0,0,0,0] # RGBA
|
107 |
|
108 |
reuse = False
|
@@ -111,7 +111,7 @@ if uploaded_file is not None:
|
|
111 |
|
112 |
with st.spinner("A IA está fazendo a mágica!"):
|
113 |
output = process_inpaint(np.array(img_input), np.array(im)) #TODO Put button here
|
114 |
-
img_output = Image.fromarray(output).convert("
|
115 |
|
116 |
|
117 |
|
|
|
19 |
raise Exception(f"Unknown image format (Available: {fmt} - case sensitive)")
|
20 |
|
21 |
pil_format = "JPEG" if fmt == "jpg" else "PNG"
|
22 |
+
file_format = "jpg" if fmt == "jpg" else "png"
|
23 |
+
mime = "image/jpeg" if fmt == "jpg" else "image/png"
|
24 |
+
|
|
|
25 |
|
26 |
buf = BytesIO()
|
27 |
+
pil_image.save(buf, format=pil_format)
|
28 |
+
|
29 |
|
30 |
|
31 |
return st.download_button(
|
|
|
102 |
(im[:, :, 1] == 0) &
|
103 |
(im[:, :, 2] == 255)
|
104 |
)
|
105 |
+
im[background] = [0, 0, 0, 255]
|
106 |
im[drawing]=[0,0,0,0] # RGBA
|
107 |
|
108 |
reuse = False
|
|
|
111 |
|
112 |
with st.spinner("A IA está fazendo a mágica!"):
|
113 |
output = process_inpaint(np.array(img_input), np.array(im)) #TODO Put button here
|
114 |
+
img_output = Image.fromarray(output).convert("RGB")
|
115 |
|
116 |
|
117 |
|