Ashrafb commited on
Commit
41f9475
·
verified ·
1 Parent(s): 00227e3

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -17,7 +17,7 @@ def load_model():
17
  global model
18
  from vtoonify_model import Model
19
  model = Model(device='cuda' if torch.cuda.is_available() else 'cpu')
20
- model.load_model('cartoon4')
21
  from fastapi.middleware.cors import CORSMiddleware
22
 
23
  app.add_middleware(
@@ -43,7 +43,7 @@ async def process_image(file: UploadFile = File(...), top: int = Form(...), bott
43
 
44
  # Process the uploaded image
45
  aligned_face, instyle, message = model.detect_and_align_image(frame_rgb, top, bottom, left, right)
46
- processed_image, message = model.image_toonify(aligned_face, instyle, model.exstyle, style_degree=0.5, style_type='cartoon4')
47
 
48
  # Convert BGR to RGB
49
  processed_image_rgb = cv2.cvtColor(processed_image, cv2.COLOR_BGR2RGB)
 
17
  global model
18
  from vtoonify_model import Model
19
  model = Model(device='cuda' if torch.cuda.is_available() else 'cpu')
20
+ model.load_model('cartoon1')
21
  from fastapi.middleware.cors import CORSMiddleware
22
 
23
  app.add_middleware(
 
43
 
44
  # Process the uploaded image
45
  aligned_face, instyle, message = model.detect_and_align_image(frame_rgb, top, bottom, left, right)
46
+ processed_image, message = model.image_toonify(aligned_face, instyle, model.exstyle, style_degree=0.5, style_type='cartoon1')
47
 
48
  # Convert BGR to RGB
49
  processed_image_rgb = cv2.cvtColor(processed_image, cv2.COLOR_BGR2RGB)