Spaces:
Sleeping
Sleeping
| 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) | |