Spaces:
Sleeping
Sleeping
Update MeAI_Maincode/Detectskindisease.py
Browse files
MeAI_Maincode/Detectskindisease.py
CHANGED
|
@@ -132,11 +132,11 @@ trans_description = {
|
|
| 132 |
}
|
| 133 |
def detect_skin_disease(image, key):
|
| 134 |
try:
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
img_byte_array = io.BytesIO()
|
| 138 |
-
|
| 139 |
-
img_byte_array.seek(0)
|
| 140 |
|
| 141 |
url = "https://detect-skin-disease1.p.rapidapi.com/skin-disease"
|
| 142 |
files = {"image": ("image.png", img_byte_array, "image/png")}
|
|
|
|
| 132 |
}
|
| 133 |
def detect_skin_disease(image, key):
|
| 134 |
try:
|
| 135 |
+
|
| 136 |
+
img = Image.fromarray(image.astype('uint8')) # Tạo ảnh từ numpy array
|
| 137 |
+
img_byte_array = io.BytesIO() # Tạo buffer giống tệp
|
| 138 |
+
img.save(img_byte_array, format='PNG') # Lưu ảnh dưới dạng PNG
|
| 139 |
+
img_byte_array.seek(0) # Quay về đầu buffer
|
| 140 |
|
| 141 |
url = "https://detect-skin-disease1.p.rapidapi.com/skin-disease"
|
| 142 |
files = {"image": ("image.png", img_byte_array, "image/png")}
|