Download verify_v1.py from TanujInsane/document-classification-env: direct link, hf CLI and curl.
- Browser
- Download file 723 Bytes
-
https://huggingface.co/spaces/TanujInsane/document-classification-env/resolve/main/verify_v1.py
- Command line
-
hf download hf://spaces/TanujInsane/document-classification-env/verify_v1.py
-
curl -L -o verify_v1.py https://huggingface.co/spaces/TanujInsane/document-classification-env/resolve/main/verify_v1.py
723 Bytes
| from environment import DocumentClassificationEnv | |
| import time | |
| env = DocumentClassificationEnv(task_difficulty='hard') | |
| obs, _ = env.reset() | |
| print("Testing Hard Step...") | |
| # Step quickly | |
| obs, reward, done, _, info = env.step(0) | |
| print(f"Reward: {reward:.4f}") | |
| print(f"Is Correct: {info.get('is_correct')}") | |
| print(f"Speed Bonus: {info.get('speed_bonus'):.4f}") | |
| print(f"Proc Cost: {info.get('proc_cost'):.4f}") | |
| print(f"True Category: {info.get('true_category')}") | |
| # Test state API | |
| telemetry = env.state() | |
| print(f"Internal State Action History Length: {len(telemetry['action_history'])}") | |
| print(f"Internal State Reward History: {telemetry['reward_history']}") | |
| print(f"Total reward from state: {telemetry['total_reward']:.4f}") | |