Ashrafb commited on
Commit
01327cb
·
verified ·
1 Parent(s): ad35e65

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +1 -2
main.py CHANGED
@@ -204,7 +204,6 @@ class Model:
204
 
205
  model = Model(device='cuda' if torch.cuda.is_available() else 'cpu')
206
 
207
-
208
  @app.post("/upload/")
209
  async def process_image(file: UploadFile = File(...), top: int = Form(...), bottom: int = Form(...), left: int = Form(...), right: int = Form(...)):
210
  if model is None:
@@ -218,7 +217,7 @@ async def process_image(file: UploadFile = File(...), top: int = Form(...), bott
218
  aligned_face, instyle, message = model.detect_and_align_image("uploaded_image.jpg", top, bottom, left, right)
219
  instyle_np = instyle['instyle'] # Extract the NumPy array from the dictionary
220
 
221
- processed_image, message = model.image_toonify(aligned_face, instyle_np, model.exstyle, style_degree=0.5, style_type='illustration1-d')
222
 
223
  # Convert processed image to bytes
224
  image_bytes = cv2.imencode('.jpg', processed_image)[1].tobytes()
 
204
 
205
  model = Model(device='cuda' if torch.cuda.is_available() else 'cpu')
206
 
 
207
  @app.post("/upload/")
208
  async def process_image(file: UploadFile = File(...), top: int = Form(...), bottom: int = Form(...), left: int = Form(...), right: int = Form(...)):
209
  if model is None:
 
217
  aligned_face, instyle, message = model.detect_and_align_image("uploaded_image.jpg", top, bottom, left, right)
218
  instyle_np = instyle['instyle'] # Extract the NumPy array from the dictionary
219
 
220
+ processed_image, message = model.image_toonify(aligned_face, instyle_np, model.exstyle, style_degree=0.5, style_type='cartoon3-d')
221
 
222
  # Convert processed image to bytes
223
  image_bytes = cv2.imencode('.jpg', processed_image)[1].tobytes()