Spaces:
Sleeping
Sleeping
Download eval/test_api.py from Zan18A/scholarbot: direct link, hf CLI and curl.
- Browser
- Download file 417 Bytes
-
https://huggingface.co/spaces/Zan18A/scholarbot/resolve/main/eval/test_api.py
- Command line
-
hf download hf://spaces/Zan18A/scholarbot/eval/test_api.py
-
curl -L -o test_api.py https://huggingface.co/spaces/Zan18A/scholarbot/resolve/main/eval/test_api.py
417 Bytes
| from fastapi.testclient import TestClient | |
| from api.main import app | |
| client = TestClient(app) | |
| def test_health(): | |
| r = client.get('/health') | |
| assert r.status_code == 200 | |
| def test_query(): | |
| r = client.post('/query', json={ | |
| 'question': 'What is attention in transformers?', | |
| 'top_k': 2, | |
| 'max_new_tokens': 64 | |
| }) | |
| assert r.status_code == 200 | |
| assert len(r.json()['answer']) > 10 | |