Extraction / test_annotations_api.py
glitz-dev
get_annotation with parameters of text and context added
4466fc1
raw
history blame contribute delete
578 Bytes
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}")