CoolFace
Apppublic

ILYAS72066/Chunky_Panday

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
Usage.py22 linesDownload Raw Back to root
1import requests
2
3# Your deployed API URL
4api_url = "https://ali124k-124-HP-1.hf.space/predict"
5
6# Path to the image you want to classify
7image_path = "Apple_scab.jpg"   # <-- replace this with your image path
8
9# Open image file in binary mode
10with open(image_path, "rb") as image_file:
11    files = {"file": image_file}
12    response = requests.post(api_url, files=files)
13
14# Check response status
15if response.status_code == 200:
16    result = response.json()
17    print("Prediction:", result["prediction"])
18    print("Confidence:", result["confidence"])
19else:
20    print("Error:", response.status_code)
21    print(response.text)
22