File size: 1,064 Bytes
fe79d42 23f48d8 c3afd26 fe79d42 3eab118 fe79d42 8852f54 3eab118 1a7150e 23f48d8 fe79d42 3eab118 fe79d42 c3afd26 3eab118 fe79d42 3eab118 c3afd26 8852f54 fe79d42 |
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 |
import numpy as np
import pyarrow as pa
from dora import DoraStatus
from utils import ask_vlm, speak
from time import sleep
LOCATION = ["LIVING_ROOM", "KITCHEN"]
## Policy Operator
class Operator:
def __init__(self):
pass
def read(self, image, text: str) -> str:
text = ask_vlm(image, text)
return text
def speak(self, text: str):
speak(text)
def check(self, image, text: str) -> bool:
text = ask_vlm(image, text)
return "Yes, " in text
def on_event(self, event: dict, send_output) -> DoraStatus:
if event["type"] == "INPUT":
id = event["id"]
# On initialization
if id == "init":
send_output("go_to", pa.array([""]))
elif id == "reached_living_room":
image = event["value"].to_numpy().reshape((540, 960, 3))
pass
elif id == "reached_kitchen":
image = event["value"].to_numpy().reshape((540, 960, 3))
pass
return DoraStatus.CONTINUE
|