File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ def __init__(self, api_token=None) -> None:
1919 self .base_url = os .environ .get (
2020 "REPLICATE_API_BASE_URL" , "https://api.replicate.com"
2121 )
22+ self .poll_interval = float (os .environ .get ("REPLICATE_POLL_INTERVAL" , "0.5" ))
2223
2324 # TODO: make thread safe
2425 self .session = requests .Session ()
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class Prediction(BaseModel):
2424 def wait (self ):
2525 """Wait for prediction to finish."""
2626 while self .status not in ["succeeded" , "failed" , "canceled" ]:
27- time .sleep (0.5 )
27+ time .sleep (self . _client . poll_interval )
2828 self .reload ()
2929
3030 def output_iterator (self ) -> Iterator [Any ]:
@@ -36,7 +36,7 @@ def output_iterator(self) -> Iterator[Any]:
3636 for output in new_output :
3737 yield output
3838 previous_output = output
39- time .sleep (0.5 )
39+ time .sleep (self . _client . poll_interval )
4040 self .reload ()
4141
4242 if self .status == "failed" :
You can’t perform that action at this time.
0 commit comments