Spaces:
Sleeping
Sleeping
Clement Vachet commited on
Commit ·
98d351c
1
Parent(s): c2c9c79
Add inference file via API
Browse files123456789101112131415161718192021222324252627from gradio_client import Client, handle_filefrom PIL import Imageimport matplotlib.pyplot as plt
# ParametersServer_URL = "http://127.0.0.1:7860/"Image_URL = 'http://images.cocodataset.org/val2017/000000039769.jpg'
# URL to client server (e.g. local server, docker container or AWS ECS)client = Client(Server_URL)
# Call to APIresult = client.predict( image=handle_file(Image_URL), api_name="/predict")
# Result is an image.webp fileprint(result)
# Display image via matplotlibimg = Image.open(result).convert("RGB")
plt.figure(figsize=(8, 5))plt.imshow(img)plt.axis('off')plt.show()inference_api.pyAdded+27