scene-understanding / client.py
lord-reso's picture
Add response time logging
b5c39fd
raw
history blame contribute delete
579 Bytes
import requests
import time
url = "https://lord-reso-scene-understanding.hf.space/generate-text/"
description = "Describe this image highlighting the positions of the objects. Use simple English words."
file_path = "assets/room.jpg"
start_time = time.time()
with open(file_path, "rb") as image_file:
files = {"file": image_file}
data = {"description": description}
response = requests.post(url, files=files, data=data)
end_time = time.time()
elapsed_time = end_time - start_time
print(response.json())
print(f"Request execution time: {elapsed_time:.2f} seconds")