Spaces:
Sleeping
Sleeping
Download client.py from pragunk/propagationshield-env: direct link, hf CLI and curl.
- Browser
- Download file 570 Bytes
-
https://huggingface.co/spaces/pragunk/propagationshield-env/resolve/main/client.py
- Command line
-
hf download hf://spaces/pragunk/propagationshield-env/client.py
-
curl -L -o client.py https://huggingface.co/spaces/pragunk/propagationshield-env/resolve/main/client.py
570 Bytes
| 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"] |