Spaces:
Running
on
Zero
Running
on
Zero
Commit
ยท
6e3a021
1
Parent(s):
61542fc
app.py
Browse files- utils/tagger.py +1 -13
utils/tagger.py
CHANGED
|
@@ -93,19 +93,7 @@ def analysis(image_path, model_dir, model):
|
|
| 93 |
tag_freq = {}
|
| 94 |
undesired_tags = ["transparent background"]
|
| 95 |
|
| 96 |
-
|
| 97 |
-
if image_path:
|
| 98 |
-
# ็ปๅใ้ใใRGBAๅฝขๅผใซๅคๆใใฆ้้ๆ
ๅ ฑใไฟๆ
|
| 99 |
-
img = Image.open(image_path)
|
| 100 |
-
img = img.convert("RGBA")
|
| 101 |
-
|
| 102 |
-
# ้้้จๅใ็ฝ่ฒใงๅกใใคใถใใญใฃใณใในใไฝๆ
|
| 103 |
-
canvas_image = Image.new('RGBA', img.size, (255, 255, 255, 255))
|
| 104 |
-
# ็ปๅใใญใฃใณใในใซใใผในใใใ้้้จๅใ็ฝ่ฒใซใชใใใใซ่จญๅฎ
|
| 105 |
-
canvas_image.paste(img, (0, 0), img)
|
| 106 |
-
|
| 107 |
-
# RGBAใใRGBใซๅคๆใใ้้้จๅใ็ฝ่ฒใซใใ
|
| 108 |
-
image_pil = canvas_image.convert("RGB")
|
| 109 |
image_preprocessed = preprocess_image(image_pil)
|
| 110 |
image_preprocessed = np.expand_dims(image_preprocessed, axis=0)
|
| 111 |
|
|
|
|
| 93 |
tag_freq = {}
|
| 94 |
undesired_tags = ["transparent background"]
|
| 95 |
|
| 96 |
+
image_pil = Image.open(image_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
image_preprocessed = preprocess_image(image_pil)
|
| 98 |
image_preprocessed = np.expand_dims(image_preprocessed, axis=0)
|
| 99 |
|