@@ -21,7 +21,7 @@ def run(
2121 ref : Union [Model , Version , ModelVersionIdentifier , str ],
2222 * ,
2323 wait : Union [int , bool , NotGiven ] = NOT_GIVEN ,
24- _use_file_output : Optional [bool ] = True ,
24+ use_file_output : Optional [bool ] = True ,
2525 ** params : Unpack [PredictionCreateParamsWithoutVersion ],
2626) -> PredictionOutput | FileOutput | Iterable [FileOutput ] | Dict [str , FileOutput ]:
2727 """
@@ -109,15 +109,18 @@ def run(
109109
110110 # TODO: Return an iterator for completed output if the model has an output iterator array type.
111111
112- return transform_output (prediction .output , client ) # type: ignore[no-any-return]
112+ if use_file_output :
113+ return transform_output (prediction .output , client ) # type: ignore[no-any-return]
114+
115+ return prediction .output
113116
114117
115118async def async_run (
116119 client : "AsyncReplicateClient" ,
117120 ref : Union [Model , Version , ModelVersionIdentifier , str ],
118121 * ,
119122 wait : Union [int , bool , NotGiven ] = NOT_GIVEN ,
120- _use_file_output : Optional [bool ] = True ,
123+ use_file_output : Optional [bool ] = True ,
121124 ** params : Unpack [PredictionCreateParamsWithoutVersion ],
122125) -> PredictionOutput | FileOutput | Iterable [FileOutput ] | Dict [str , FileOutput ]:
123126 """
@@ -205,4 +208,7 @@ async def async_run(
205208
206209 # TODO: Return an iterator for completed output if the model has an output iterator array type.
207210
208- return transform_output (prediction .output , client ) # type: ignore[no-any-return]
211+ if use_file_output :
212+ return transform_output (prediction .output , client ) # type: ignore[no-any-return]
213+
214+ return prediction .output
0 commit comments