Spaces:
Sleeping
Sleeping
File size: 570 Bytes
dada368 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import requests
class Client:
def __init__(self, base_url="http://localhost:8000"):
self.base_url = base_url
def reset(self, config=None):
if config is None:
config = {}
response = requests.post(f"{self.base_url}/reset", json=config).json()
return response["observation"], response["state"]
def step(self, action_dict):
response = requests.post(f"{self.base_url}/step", json=action_dict).json()
return response["observation"], response["reward"], response["done"], response["info"] |