Spaces:
Sleeping
Sleeping
Download src/evaluation/evaluate.py from LeahRocks/SafeSpaceAI: direct link, hf CLI and curl.
- Browser
- Download file 238 Bytes
-
https://huggingface.co/spaces/LeahRocks/SafeSpaceAI/resolve/main/src/evaluation/evaluate.py
- Command line
-
hf download hf://spaces/LeahRocks/SafeSpaceAI/src/evaluation/evaluate.py
-
curl -L -o evaluate.py https://huggingface.co/spaces/LeahRocks/SafeSpaceAI/resolve/main/src/evaluation/evaluate.py
238 Bytes
| def evaluate(agent, env): | |
| correct = 0 | |
| total = len(env.data) | |
| for text, label in env.data: | |
| action = agent.choose_action(text) | |
| if action == label: | |
| correct += 1 | |
| print("Accuracy:", correct / total) |