Download runtime/client_example.py from myx160/pi05-pap-rtc: direct link, hf CLI and curl.
- Browser
- Download file 905 Bytes
-
https://huggingface.co/myx160/pi05-pap-rtc/resolve/main/runtime/client_example.py
- Command line
-
hf download hf://myx160/pi05-pap-rtc/runtime/client_example.py
-
curl -L -o client_example.py https://huggingface.co/myx160/pi05-pap-rtc/resolve/main/runtime/client_example.py
905 Bytes
| """Send the synthetic example to a running policy server; no robot actuation.""" | |
| import argparse | |
| from pathlib import Path | |
| import numpy as np | |
| from pap_runtime import load_request | |
| from openpi_client.websocket_client_policy import WebsocketClientPolicy | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--host', default='127.0.0.1') | |
| parser.add_argument('--port', type=int, default=8000) | |
| parser.add_argument('--request', type=Path, default=Path(__file__).resolve().parent / 'examples/synthetic_request.npz') | |
| parser.add_argument('--output', type=Path, default=Path('client_output.npz')) | |
| args = parser.parse_args() | |
| client = WebsocketClientPolicy(args.host, args.port) | |
| result = client.infer(load_request(args.request)) | |
| np.savez_compressed(args.output, actions=result['actions'], action_postfix=result['action_postfix']) | |
| print('actions:',result['actions'].shape,'postfix:',result['action_postfix'].shape) | |