Luisgust commited on
Commit
004edf3
·
verified ·
1 Parent(s): 10ef16d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -20,7 +20,7 @@ def load_model():
20
  global model
21
  from vtoonify_model import Model
22
  model = Model(device='cuda' if torch.cuda.is_available() else 'cpu')
23
- model.load_model('cartoon4')
24
 
25
  # Initialize the InsightFace model for face detection
26
  face_detector = FaceAnalysis(allowed_modules=['detection'])
@@ -104,7 +104,7 @@ async def process_image(file: UploadFile = File(...), top: int = Form(...), bott
104
  logging.error("Failed to process the image: No face detected or alignment failed.")
105
  return {"error": message}
106
 
107
- processed_image, message = model.image_toonify(aligned_face, instyle, model.exstyle, style_degree=0.5, style_type='cartoon2-d')
108
  if processed_image is None:
109
  logging.error("Failed to toonify the image.")
110
  return {"error": message}
 
20
  global model
21
  from vtoonify_model import Model
22
  model = Model(device='cuda' if torch.cuda.is_available() else 'cpu')
23
+ model.load_model('cartoon3-d')
24
 
25
  # Initialize the InsightFace model for face detection
26
  face_detector = FaceAnalysis(allowed_modules=['detection'])
 
104
  logging.error("Failed to process the image: No face detected or alignment failed.")
105
  return {"error": message}
106
 
107
+ processed_image, message = model.image_toonify(aligned_face, instyle, model.exstyle, style_degree=0.5, style_type='cartoon3-d')
108
  if processed_image is None:
109
  logging.error("Failed to toonify the image.")
110
  return {"error": message}