Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ from inference import Predictor
|
|
8 |
|
9 |
def parse_args():
|
10 |
parser = argparse.ArgumentParser()
|
11 |
-
parser.add_argument('--weight', type=str, default='
|
12 |
parser.add_argument('--device', type=str, default='cpu', help='Device, cuda or cpu')
|
13 |
|
14 |
return parser.parse_args()
|
@@ -16,6 +16,7 @@ def parse_args():
|
|
16 |
def transfer(image, transfer_style):
|
17 |
if transfer_style == "Hayao":
|
18 |
#output = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)# 转换为灰度图像
|
|
|
19 |
predictor = Predictor(args.weight, args.device)
|
20 |
anime_img = predictor.transform_image(args.src, save_path)
|
21 |
return anime_img
|
|
|
8 |
|
9 |
def parse_args():
|
10 |
parser = argparse.ArgumentParser()
|
11 |
+
parser.add_argument('--weight', type=str, default='GeneratorV2_train_photo_Hayao_init.pt')
|
12 |
parser.add_argument('--device', type=str, default='cpu', help='Device, cuda or cpu')
|
13 |
|
14 |
return parser.parse_args()
|
|
|
16 |
def transfer(image, transfer_style):
|
17 |
if transfer_style == "Hayao":
|
18 |
#output = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)# 转换为灰度图像
|
19 |
+
os.system("wget https://huggingface.co/YANGYYYY/cartoonize/resolve/main/GeneratorV2_train_photo_Hayao_init.pt")
|
20 |
predictor = Predictor(args.weight, args.device)
|
21 |
anime_img = predictor.transform_image(args.src, save_path)
|
22 |
return anime_img
|