File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -114,8 +114,20 @@ def base64_encode_file(file: io.IOBase) -> str:
114
114
115
115
116
116
class FileOutput (httpx .SyncByteStream , httpx .AsyncByteStream ):
117
+ """
118
+ An object that can be used to read the contents of an output file
119
+ created by running a Replicate model.
120
+ """
121
+
117
122
url : str
123
+ """
124
+ The file URL.
125
+ """
126
+
118
127
client : "Client"
128
+ """
129
+ A Replicate client used to download the file.
130
+ """
119
131
120
132
def __init__ (self , url : str , client : "Client" ) -> None :
121
133
self .url = url
@@ -147,6 +159,10 @@ def __str__(self) -> str:
147
159
148
160
149
161
def transform_output (value : Any , client : "Client" ) -> Any :
162
+ """
163
+ Transform the output of a prediction to a `FileOutput` object if it's a URL.
164
+ """
165
+
150
166
def transform (obj : Any ) -> Any :
151
167
if isinstance (obj , Mapping ):
152
168
return {k : transform (v ) for k , v in obj .items ()}
You can’t perform that action at this time.
0 commit comments