Spaces:
Running
Running
Rename main (37).py to main.py
Browse files- main (37).py → main.py +6 -1
main (37).py → main.py
RENAMED
@@ -216,7 +216,12 @@ async def process_image(file: UploadFile = File(...), top: int = Form(...), bott
|
|
216 |
|
217 |
# Process the uploaded image
|
218 |
aligned_face, instyle, message = model.detect_and_align_image("uploaded_image.jpg", top, bottom, left, right)
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
# Convert processed image to bytes
|
222 |
image_bytes = cv2.imencode('.jpg', processed_image)[1].tobytes()
|
|
|
216 |
|
217 |
# Process the uploaded image
|
218 |
aligned_face, instyle, message = model.detect_and_align_image("uploaded_image.jpg", top, bottom, left, right)
|
219 |
+
|
220 |
+
# Convert BGR to RGB
|
221 |
+
aligned_face_rgb = cv2.cvtColor(aligned_face, cv2.COLOR_BGR2RGB)
|
222 |
+
|
223 |
+
# Toonify the image
|
224 |
+
processed_image, message = model.image_toonify(aligned_face_rgb, instyle, model.exstyle, style_degree=0.5, style_type='illustration1-d')
|
225 |
|
226 |
# Convert processed image to bytes
|
227 |
image_bytes = cv2.imencode('.jpg', processed_image)[1].tobytes()
|