Spaces:
Running
Running
Update main.py
Browse files
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('
|
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='
|
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)
|