Spaces:
Sleeping
Sleeping
File size: 665 Bytes
98d351c ae565a0 98d351c ae565a0 98d351c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
from gradio_client import Client, handle_file
from PIL import Image
import matplotlib.pyplot as plt
# Parameters
Server_URL = "cvachet/object_detection_gradio"
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 API
result = client.predict(
image=handle_file(Image_URL),
model_id="hustvl/yolos-small",
threshold=0.9,
api_name="/detect"
)
# Result is an image.webp file
print(result)
# Display image via matplotlib
img = Image.open(result).convert("RGB")
plt.figure(figsize=(8, 5))
plt.imshow(img)
plt.axis('off')
plt.show()
|