Spaces:
Sleeping
Sleeping
| import requests | |
| import json | |
| # Test the API | |
| def test_api(): | |
| # Test deployed Hugging Face Space | |
| url = "https://pranavinani-gaze-emotion-api.hf.space/analyze" | |
| with open("image.png", "rb") as f: | |
| files = {"file": ("image.png", f, "image/png")} | |
| response = requests.post(url, files=files) | |
| if response.status_code == 200: | |
| result = response.json() | |
| print(json.dumps(result, indent=2)) | |
| else: | |
| print(f"Error: {response.status_code}") | |
| print(response.text) | |
| if __name__ == "__main__": | |
| test_api() | |