-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathmain.py
78 lines (66 loc) · 1.81 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"""
Self-Operating Computer
"""
import argparse
from operate.utils.style import ANSI_BRIGHT_MAGENTA
from operate.operate import main
def main_entry():
parser = argparse.ArgumentParser(
description="Run the self-operating-computer with a specified model."
)
parser.add_argument(
"-m",
"--model",
help="Specify the model to use",
required=False,
default="gpt-4-with-ocr",
)
# Add a voice flag
parser.add_argument(
"--voice",
help="Use voice input mode",
action="store_true",
)
# Add a flag for verbose mode
parser.add_argument(
"--verbose",
help="Run operate in verbose mode",
action="store_true",
)
# Allow for direct input of prompt
parser.add_argument(
"--prompt",
help="Directly input the objective prompt",
type=str,
required=False,
)
# Add OCR flag for Ollama models
parser.add_argument(
"--ocr",
help="Enable OCR for Ollama models",
action="store_true",
)
# Add browser preference flag
parser.add_argument(
"-b",
"--browser",
help="Specify preferred browser (default: Google Chrome)",
type=str,
default="Google Chrome",
)
try:
args = parser.parse_args()
# No need to prompt for model name if it's directly specified
# The Ollama model name can now be passed directly
main(
args.model,
terminal_prompt=args.prompt,
voice_mode=args.voice,
verbose_mode=args.verbose,
ocr_mode=args.ocr,
browser=args.browser
)
except KeyboardInterrupt:
print(f"\n{ANSI_BRIGHT_MAGENTA}Exiting...")
if __name__ == "__main__":
main_entry()