File size: 725 Bytes
0bcab2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import httpx, json
BASE = 'https://tvganesh538-nlp-classifier-api.hf.space'
KEY  = 'YOUR_SECRET_HERE'

# Check full debug info
r = httpx.get(f'{BASE}/debug/predictor', headers={'X-API-Key': KEY}, timeout=30)
print('Predictor debug:', json.dumps(r.json(), indent=2))

# Check health for more detail
r2 = httpx.get(f'{BASE}/health', timeout=30)
print('Health:', json.dumps(r2.json(), indent=2))

# Single classify with full response
r3 = httpx.post(f'{BASE}/classify',
    headers={'X-API-Key': KEY},
    json={'inputs': '[HERB] St Johns Wort [DRUG] Warfarin [TYPE] Herb [REL] reduces effectiveness of anticoagulation warfarin bleeding risk'},
    timeout=120)
print('Full response:')
print(json.dumps(r3.json(), indent=2))