LeakDetection / api_example.py
AlexLach's picture
api endpoint example
5458da7
raw
history blame contribute delete
353 Bytes
import gradio as gr
import requests
img_encode = gr.processing_utils.encode_url_or_file_to_base64("cropped.jpg")
r = requests.post(
url="https://hf.space/embed/AlexLach/LeakDetection/+/api/predict",
json={"data": [img_encode]},
)
print(r.json()["data"][0]["confidences"][0]["label"])
print(r.json()["data"][0]["confidences"][0]["confidence"])