Spaces:
Sleeping
Sleeping
File size: 564 Bytes
407933e 169a6ba 407933e 169a6ba 407933e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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()
|