File size: 626 Bytes
411a994
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import requests
import io

API_URL = "http://localhost:8000/api/ai/form"

text = "Patient with rash and fever for 2 days."

# Fetch a small sample image
img_url = "https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png"
img_bytes = requests.get(img_url, timeout=15).content

files = [
    ("images", ("sample.png", io.BytesIO(img_bytes), "image/png")),
]

data = {
    "text": text,
    "want_stats": "true",
    "location": "Douala, Cameroon",
}

resp = requests.post(API_URL, data=data, files=files)
print("Status:", resp.status_code)
try:
    print(resp.json())
except Exception:
    print(resp.text)