Add cpu only option instead of gpu option.

This commit is contained in:
corkborg
2024-04-23 01:59:22 +09:00
parent 3d95488407
commit 7ecb4ed526
3 changed files with 9 additions and 18 deletions
+5 -10
View File
@@ -1,8 +1,3 @@
import sys
from sympy import use
from tagger.interrogator import Interrogator, WaifuDiffusionInterrogator
from PIL import Image
from pathlib import Path
@@ -30,9 +25,9 @@ parser.add_argument(
action='store_true',
help='Overwrite the file if it exists')
parser.add_argument(
'--gpu',
'--cpu',
action='store_true',
help='Use GPU (Compatible CUDA and cuDNN required)')
help='Use CPU only')
parser.add_argument(
'--model',
default='wd14-convnextv2.v1',
@@ -43,8 +38,8 @@ args = parser.parse_args()
# get interrogator configs
interrogator = interrogators[args.model]
if args.gpu:
interrogator.use_gpu()
if args.cpu:
interrogator.use_cpu()
def image_interrogate(image_path: Path):
"""
@@ -72,7 +67,7 @@ if args.dir:
tags = image_interrogate(image_path)
tags_str = ", ".join(tags.keys())
with open(caption_path, "w") as fp:
with open(caption_path, 'w') as fp:
fp.write(tags_str)
if args.file: