File size: 644 Bytes
ab51942
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import requests

# Your deployed API URL
api_url = "https://ali124k-124-HP-1.hf.space/predict"

# Path to the image you want to classify
image_path = "Apple_scab.jpg"   # <-- replace this with your image path

# Open image file in binary mode
with open(image_path, "rb") as image_file:
    files = {"file": image_file}
    response = requests.post(api_url, files=files)

# Check response status
if response.status_code == 200:
    result = response.json()
    print("Prediction:", result["prediction"])
    print("Confidence:", result["confidence"])
else:
    print("Error:", response.status_code)
    print(response.text)