-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_api.sh
More file actions
executable file
·48 lines (39 loc) · 1.31 KB
/
test_api.sh
File metadata and controls
executable file
·48 lines (39 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Test script for TinyBERT Service API
BASE_URL="http://localhost:8001"
echo "========================================"
echo "Testing TinyBERT Service API"
echo "========================================"
echo ""
# Test 1: Root endpoint
echo "1. Testing root endpoint..."
curl -s $BASE_URL/ | python3 -m json.tool
echo ""
# Test 2: Health check
echo "2. Testing health check..."
curl -s $BASE_URL/api/v1/health | python3 -m json.tool
echo ""
# Test 3: Predict with full probabilities
echo "3. Testing predict endpoint..."
curl -s -X POST $BASE_URL/api/v1/predict \
-H "Content-Type: application/json" \
-d '{"texts": ["I love this product!", "This is terrible"]}' \
| python3 -m json.tool
echo ""
# Test 4: Predict top label
echo "4. Testing predict/top endpoint..."
curl -s -X POST $BASE_URL/api/v1/predict/top \
-H "Content-Type: application/json" \
-d '{"texts": ["Amazing experience!", "Worst product ever"]}' \
| python3 -m json.tool
echo ""
# Test 5: Batch predict
echo "5. Testing predict/batch endpoint..."
curl -s -X POST $BASE_URL/api/v1/predict/batch \
-H "Content-Type: application/json" \
-d '{"texts": ["text1", "text2", "text3"]}' \
| python3 -m json.tool
echo ""
echo "========================================"
echo "All tests completed!"
echo "========================================"