Spaces:
Sleeping
Sleeping
| import requests | |
| import json | |
| API_URL = "http://localhost:8000/api/ai" | |
| # Test 1 : Texte seul | |
| payload_text = { | |
| "text": "Patient présentant une éruption cutanée et de la fièvre depuis 2 jours.", | |
| "want_stats": True | |
| } | |
| # Test 2 : Image seule | |
| payload_image = { | |
| "image": "https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png", | |
| "want_stats": True | |
| } | |
| # Test 3 : Texte + Image | |
| payload_multimodal = { | |
| "text": "Patient présentant une éruption cutanée et de la fièvre depuis 2 jours.", | |
| "image": "https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png", | |
| "want_stats": True | |
| } | |
| for label, payload in [ | |
| ("Texte seul", payload_text), | |
| ("Image seule", payload_image), | |
| ("Texte + Image", payload_multimodal) | |
| ]: | |
| print(f"\n=== Test : {label} ===") | |
| response = requests.post(API_URL, json=payload) | |
| print("Status:", response.status_code) | |
| try: | |
| print(json.dumps(response.json(), indent=2, ensure_ascii=False)) | |
| except Exception: | |
| print(response.text) | |