Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -219,7 +219,11 @@ async def process_image(file: UploadFile = File(...), top: int = Form(...), bott
|
|
219 |
|
220 |
# Convert BGR to RGB
|
221 |
aligned_face_rgb = cv2.cvtColor(aligned_face, cv2.COLOR_BGR2RGB)
|
222 |
-
|
|
|
|
|
|
|
|
|
223 |
|
224 |
# Toonify the image
|
225 |
processed_image, message = model.image_toonify(aligned_face_rgb, instyle_rgb, model.exstyle, style_degree=0.5, style_type='cartoon3-d')
|
@@ -236,3 +240,4 @@ app.mount("/", StaticFiles(directory="AB", html=True), name="static")
|
|
236 |
@app.get("/")
|
237 |
def index() -> FileResponse:
|
238 |
return FileResponse(path="/app/AB/index.html", media_type="text/html")
|
|
|
|
219 |
|
220 |
# Convert BGR to RGB
|
221 |
aligned_face_rgb = cv2.cvtColor(aligned_face, cv2.COLOR_BGR2RGB)
|
222 |
+
# Convert instyle tensor to numpy array
|
223 |
+
instyle_np = instyle.cpu().numpy()
|
224 |
+
|
225 |
+
# Convert BGR to RGB
|
226 |
+
instyle_rgb = cv2.cvtColor(instyle_np, cv2.COLOR_BGR2RGB)
|
227 |
|
228 |
# Toonify the image
|
229 |
processed_image, message = model.image_toonify(aligned_face_rgb, instyle_rgb, model.exstyle, style_degree=0.5, style_type='cartoon3-d')
|
|
|
240 |
@app.get("/")
|
241 |
def index() -> FileResponse:
|
242 |
return FileResponse(path="/app/AB/index.html", media_type="text/html")
|
243 |
+
|