resnet-classifier/image_classifier/__main__.py
2023-08-05 03:48:06 +00:00

20 lines
641 B
Python
Executable File

import argparse
from pathlib import Path
from .inference import CAPTCHA
def main():
parser = argparse.ArgumentParser("CAPTCHA")
parser.add_argument("path", type=Path)
parser.add_argument("--yaml", type=Path, default=None)
parser.add_argument("--ckpt", type=Path, default=None)
parser.add_argument("--temp", type=float, default=1.0)
parser.add_argument("--device", default="cuda")
args = parser.parse_args()
captcha = CAPTCHA( config=args.yaml, ckpt=args.ckpt, device=args.device )
answer = captcha.inference( path=args.path, temperature=args.temp )
print("Answer:", answer)
if __name__ == "__main__":
main()