lord-reso commited on
Commit
b5c39fd
·
1 Parent(s): b626bbe

Add response time logging

Browse files
Files changed (1) hide show
  1. client.py +6 -0
client.py CHANGED
@@ -1,12 +1,18 @@
1
  import requests
 
2
 
3
  url = "https://lord-reso-scene-understanding.hf.space/generate-text/"
4
  description = "Describe this image highlighting the positions of the objects. Use simple English words."
5
  file_path = "assets/room.jpg"
 
6
 
7
  with open(file_path, "rb") as image_file:
8
  files = {"file": image_file}
9
  data = {"description": description}
10
  response = requests.post(url, files=files, data=data)
11
 
 
 
 
12
  print(response.json())
 
 
1
  import requests
2
+ import time
3
 
4
  url = "https://lord-reso-scene-understanding.hf.space/generate-text/"
5
  description = "Describe this image highlighting the positions of the objects. Use simple English words."
6
  file_path = "assets/room.jpg"
7
+ start_time = time.time()
8
 
9
  with open(file_path, "rb") as image_file:
10
  files = {"file": image_file}
11
  data = {"description": description}
12
  response = requests.post(url, files=files, data=data)
13
 
14
+ end_time = time.time()
15
+ elapsed_time = end_time - start_time
16
+
17
  print(response.json())
18
+ print(f"Request execution time: {elapsed_time:.2f} seconds")