File size: 578 Bytes
4466fc1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import requests
import json

url = "http://localhost:8000/get_annotations"
payload = {
    "sample_text": "cancer",
    "sample_context": "cancer is common in nowadays, its better to diagnosis in early stages. Recovery will be faster"
}

try:
    print(f"Sending request to {url}...")
    response = requests.post(url, json=payload, timeout=120)
    print(f"Status Code: {response.status_code}")
    print("Response Content:")
    try:
        print(json.dumps(response.json(), indent=2))
    except:
        print(response.text)
except Exception as e:
    print(f"Error: {e}")