-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathmain.py
47 lines (38 loc) · 1.3 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from dotenv import load_dotenv
import argparse
from driver.types import DebugConfig
load_dotenv()
from driver.executor import start
def main():
parser = argparse.ArgumentParser()
parser.add_argument("task", type=str, help="The task to execute")
parser.add_argument(
"--ocr",
help="Which OCR provider to use: Azure, Google or Baidu. Default to whatever is set in the .env file",
choices=["azure", "google", "baidu"],
)
parser.add_argument(
"--debug-ocr",
action="store_true",
help="Display bounding boxes of OCR results for debugging their position before executing the action",
)
parser.add_argument(
"--debug-uied",
action="store_true",
help="Display bounding boxes of UIED detected elements for debugging their position before executing the action",
)
parser.add_argument(
"--debug-annotations",
action="store_true",
help="Display annotations for debugging their position before executing the action",
)
args = parser.parse_args()
debug: DebugConfig = {
"ocr_provider": args.ocr,
"annotations": args.debug_annotations,
"ocr": args.debug_ocr,
"uied": args.debug_uied,
}
start(args.task, debug=debug)
if __name__ == "__main__":
main()