3030class TritonPythonModel (BaseTritonPythonModel ):
3131 def initialize (self , args ):
3232 super ().initialize (args )
33-
34- self .pipeline .inintial_visual_predictor (self .pipeline .config )
35-
3633 self .context = {}
3734 self .context ["file_storage" ] = None
3835 self .context ["return_img_urls" ] = False
36+ self .context ["url_expires_in" ] = - 1
3937 self .context ["max_num_input_imgs" ] = _DEFAULT_MAX_NUM_INPUT_IMGS
4038 self .context ["max_output_img_size" ] = _DEFAULT_MAX_OUTPUT_IMG_SIZE
4139 if self .app_config .extra :
@@ -47,6 +45,8 @@ def initialize(self, args):
4745 self .context ["return_img_urls" ] = self .app_config .extra [
4846 "return_img_urls"
4947 ]
48+ if "url_expires_in" in self .app_config .extra :
49+ self .context ["url_expires_in" ] = self .app_config .extra ["url_expires_in" ]
5050 if "max_num_input_imgs" in self .app_config .extra :
5151 self .context ["max_num_input_imgs" ] = self .app_config .extra [
5252 "max_num_input_imgs"
@@ -151,6 +151,7 @@ def run(self, input, log_id):
151151 filename_template = f"markdown_{ i } /{{key}}" ,
152152 file_storage = self .context ["file_storage" ],
153153 return_urls = self .context ["return_img_urls" ],
154+ url_expires_in = self .context ["url_expires_in" ],
154155 max_img_size = self .context ["max_output_img_size" ],
155156 )
156157 md_flags = md_data ["page_continuation_flags" ]
@@ -165,6 +166,7 @@ def run(self, input, log_id):
165166 filename_template = f"{{key}}_{ i } .jpg" ,
166167 file_storage = self .context ["file_storage" ],
167168 return_urls = self .context ["return_img_urls" ],
169+ url_expires_in = self .context ["url_expires_in" ],
168170 max_img_size = self .context ["max_output_img_size" ],
169171 )
170172 else :
0 commit comments