Update main.py
Browse files
main.py
CHANGED
@@ -5,13 +5,13 @@ from fastapi import FastAPI, File, UploadFile
|
|
5 |
from pydantic import BaseModel
|
6 |
import numpy as np
|
7 |
import cv2
|
|
|
8 |
from vtoonify_model import Model
|
9 |
|
10 |
app = FastAPI()
|
11 |
|
12 |
# Load the model
|
13 |
-
|
14 |
-
model = Model(device)
|
15 |
exstyle, message = model.load_model("cartoon1")
|
16 |
|
17 |
class ImageRequest(BaseModel):
|
|
|
5 |
from pydantic import BaseModel
|
6 |
import numpy as np
|
7 |
import cv2
|
8 |
+
import torch
|
9 |
from vtoonify_model import Model
|
10 |
|
11 |
app = FastAPI()
|
12 |
|
13 |
# Load the model
|
14 |
+
model = Model(device='cuda' if torch.cuda.is_available() else 'cpu')
|
|
|
15 |
exstyle, message = model.load_model("cartoon1")
|
16 |
|
17 |
class ImageRequest(BaseModel):
|