Open willhy4 opened 2 weeks ago
👋 Hello @willhy4, thank you for raising an issue about Ultralytics HUB 🚀! Please visit our HUB Docs to learn more:
If this is a 🐛 Bug Report, please provide screenshots and steps to reproduce your problem to help us get started working on a fix.
If this is a ❓ Question, please provide as much information as possible, including dataset, model, environment details etc. so that we might provide the most helpful response.
We try to respond to all issues as promptly as possible. Thank you for your patience!
Search before asking
HUB Component
Inference
Bug
HTTPError Traceback (most recent call last) Cell In[13], line 16 12 response = requests.post(url, headers=headers, data=data, files={"image": f}) 13 #if response.status_code == 429: 14 # time.sleep(int(response.headers["Retry-After"])) ---> 16 response.raise_for_status() 18 # Get predicted class and confidence from response 19 predicted_class = response.json()['data'][0]['class']
File ~/Python310-boto3/lib/python3.10/site-packages/requests/models.py:1021, in Response.raise_for_status(self) 1016 http_error_msg = ( 1017 f"{self.status_code} Server Error: {reason} for url: {self.url}" 1018 ) 1020 if http_error_msg: -> 1021 raise HTTPError(http_error_msg, response=self)
HTTPError: 502 Server Error: Bad Gateway for url: https://api.ultralytics.com/v1/predict/AFX0h0mvCLGtEDjTVvbJ
Environment
Minimal Reproducible Example
I am attempting to run inference on 100 images and I get this same error for every model (17 of them) that I have created.
Here's the code:
Iterate through items and store results in lists
for image_filename in os.listdir(image_folder_path): if image_filename.endswith(('.jpg', '.jpeg', '.png', '.gif')): image_path = os.path.join(image_folder_path, image_filename) label_filename = os.path.splitext(image_filename)[0] + '.txt' label_path = os.path.join(label_folder_path, label_filename)
Function to read label file and extract class information
def read_label_file(label_file_path): with open(label_file_path, 'r') as label_file:
Read the first line of the label file
Additional
The url, headers, and data values were copy/paste from the "Deploy" page for each model.