-
-
Notifications
You must be signed in to change notification settings - Fork 198
/
main.py
56 lines (44 loc) · 1.43 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
import argparse
import time
from whisper_mic import WhisperMic
import vision
from vimbot import Vimbot
def main(voice_mode):
print("Initializing the Vimbot driver...")
driver = Vimbot()
print("Navigating to Google...")
driver.navigate("https://www.google.com")
if voice_mode:
print("Voice mode enabled. Listening for your command...")
mic = WhisperMic()
try:
objective = mic.listen()
except Exception as e:
print(f"Error in capturing voice input: {e}")
return # Exit if voice input fails
print(f"Objective received: {objective}")
else:
objective = input("Please enter your objective: ")
while True:
time.sleep(1)
print("Capturing the screen...")
screenshot = driver.capture()
print("Getting actions for the given objective...")
action = vision.get_actions(screenshot, objective)
print(f"JSON Response: {action}")
if driver.perform_action(action): # returns True if done
break
def main_entry():
parser = argparse.ArgumentParser(description="Run the Vimbot with optional voice input.")
parser.add_argument(
"--voice",
help="Enable voice input mode",
action="store_true",
)
args = parser.parse_args()
main(args.voice)
if __name__ == "__main__":
try:
main_entry()
except KeyboardInterrupt:
print("Exiting...")