Files
sci-gui-agent-benchmark/controller.py
2023-10-24 02:26:24 +08:00

17 lines
597 B
Python

import numpy as np
from PIL import Image
from simulator import EmulatorSimulator
class Controller:
def __init__(self, vm_name: str, username: str, password: str, host: str) -> None:
self.simulator = EmulatorSimulator(vm_name=vm_name, username=username,
password=password, host=host)
def get_state(self) -> np.ndarray:
image_path = self.simulator.get_screenshot()
with Image.open(image_path) as img:
return np.array(img)
def step(self) -> None:
self.simulator.keyboard_type("hello word")