modify replicate polling interval

This commit is contained in:
ishaan-jaff 2023-10-02 07:43:37 -07:00
parent e62b3ebdd1
commit a4d135eef9

View file

@ -53,7 +53,7 @@ def handle_prediction_response(prediction_url, api_token, print_verbose):
logs = "" logs = ""
while True and (status not in ["succeeded", "failed", "canceled"]): while True and (status not in ["succeeded", "failed", "canceled"]):
print_verbose("making request") print_verbose("making request")
time.sleep(0.0001) time.sleep(0.5)
response = requests.get(prediction_url, headers=headers) response = requests.get(prediction_url, headers=headers)
if response.status_code == 200: if response.status_code == 200:
response_data = response.json() response_data = response.json()
@ -77,7 +77,7 @@ def handle_prediction_response_streaming(prediction_url, api_token, print_verbos
} }
status = "" status = ""
while True and (status not in ["succeeded", "failed", "canceled"]): while True and (status not in ["succeeded", "failed", "canceled"]):
time.sleep(0.0001) # prevent being rate limited by replicate time.sleep(0.5) # prevent being rate limited by replicate
response = requests.get(prediction_url, headers=headers) response = requests.get(prediction_url, headers=headers)
if response.status_code == 200: if response.status_code == 200:
response_data = response.json() response_data = response.json()