medilang-tech / scripts /test_ai_form.py
Dama03's picture
first push of the AI
411a994
raw
history blame
626 Bytes
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)