FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
replicate-python/tests/factories.py at main · windweb/replicate-python · GitHub
windweb
/
replicate-python
Public
forked from
replicate/replicate-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
replicate-python
/
tests
/
factories.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
186 lines (175 loc) · 7.08 KB
Breadcrumbs
replicate-python
/
tests
/
factories.py
Copy path
File metadata and controls
186 lines (175 loc) · 7.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import
datetime
from
replicate
.
client
import
Client
from
replicate
.
version
import
Version
def
create_client
():
client
=
Client
(
api_token
=
"abc123"
)
return
client
def
create_version
(
client
=
None
,
openapi_schema
=
None
,
cog_version
=
"0.3.0"
):
if
client
is
None
:
client
=
create_client
()
version
=
Version
(
id
=
"v1"
,
created_at
=
datetime
.
datetime
.
now
(),
cog_version
=
cog_version
,
openapi_schema
=
openapi_schema
or
{
"info"
: {
"title"
:
"Cog"
,
"version"
:
"0.1.0"
},
"paths"
: {
"/"
: {
"get"
: {
"summary"
:
"Root"
,
"responses"
: {
"200"
: {
"content"
: {
"application/json"
: {
"schema"
: {}}},
"description"
:
"Successful Response"
,
}
},
"operationId"
:
"root__get"
,
}
},
"/predictions"
: {
"post"
: {
"summary"
:
"Predict"
,
"responses"
: {
"200"
: {
"content"
: {
"application/json"
: {
"schema"
: {
"$ref"
:
"#/components/schemas/Response"
}
}
},
"description"
:
"Successful Response"
,
},
"422"
: {
"content"
: {
"application/json"
: {
"schema"
: {
"$ref"
:
"#/components/schemas/HTTPValidationError"
}
}
},
"description"
:
"Validation Error"
,
},
},
"description"
:
"Run a single prediction on the model"
,
"operationId"
:
"predict_predictions_post"
,
"requestBody"
: {
"content"
: {
"application/json"
: {
"schema"
: {
"$ref"
:
"#/components/schemas/Request"
}
}
}
},
}
},
},
"openapi"
:
"3.0.2"
,
"components"
: {
"schemas"
: {
"Input"
: {
"type"
:
"object"
,
"title"
:
"Input"
,
"required"
: [
"text"
],
"properties"
: {
"text"
: {
"type"
:
"string"
,
"title"
:
"Text"
,
"x-order"
:
0
,
"description"
:
"Text to prefix with 'hello '"
,
}
},
},
"Output"
: {
"type"
:
"string"
,
"title"
:
"Output"
},
"Status"
: {
"enum"
: [
"processing"
,
"succeeded"
,
"failed"
],
"type"
:
"string"
,
"title"
:
"Status"
,
"description"
:
"An enumeration."
,
},
"Request"
: {
"type"
:
"object"
,
"title"
:
"Request"
,
"properties"
: {
"input"
: {
"$ref"
:
"#/components/schemas/Input"
},
"output_file_prefix"
: {
"type"
:
"string"
,
"title"
:
"Output File Prefix"
,
},
},
"description"
:
"The request body for a prediction"
,
},
"Response"
: {
"type"
:
"object"
,
"title"
:
"Response"
,
"required"
: [
"status"
],
"properties"
: {
"error"
: {
"type"
:
"string"
,
"title"
:
"Error"
},
"output"
: {
"$ref"
:
"#/components/schemas/Output"
},
"status"
: {
"$ref"
:
"#/components/schemas/Status"
},
},
"description"
:
"The response body for a prediction"
,
},
"ValidationError"
: {
"type"
:
"object"
,
"title"
:
"ValidationError"
,
"required"
: [
"loc"
,
"msg"
,
"type"
],
"properties"
: {
"loc"
: {
"type"
:
"array"
,
"items"
: {
"anyOf"
: [
{
"type"
:
"string"
},
{
"type"
:
"integer"
},
]
},
"title"
:
"Location"
,
},
"msg"
: {
"type"
:
"string"
,
"title"
:
"Message"
},
"type"
: {
"type"
:
"string"
,
"title"
:
"Error Type"
},
},
},
"HTTPValidationError"
: {
"type"
:
"object"
,
"title"
:
"HTTPValidationError"
,
"properties"
: {
"detail"
: {
"type"
:
"array"
,
"items"
: {
"$ref"
:
"#/components/schemas/ValidationError"
},
"title"
:
"Detail"
,
}
},
},
}
},
},
)
version
.
_client
=
client
return
version
def
create_version_with_iterator_output
():
version
=
create_version
(
cog_version
=
"0.3.9"
)
version
.
openapi_schema
[
"components"
][
"schemas"
][
"Output"
]
=
{
"type"
:
"array"
,
"items"
: {
"type"
:
"string"
},
"title"
:
"Output"
,
"x-cog-array-type"
:
"iterator"
,
}
return
version
def
create_version_with_list_output
():
version
=
create_version
(
cog_version
=
"0.3.9"
)
version
.
openapi_schema
[
"components"
][
"schemas"
][
"Output"
]
=
{
"type"
:
"array"
,
"items"
: {
"type"
:
"string"
},
"title"
:
"Output"
,
}
return
version
def
create_version_with_iterator_output_backwards_compatibility_0_3_8
():
version
=
create_version
(
cog_version
=
"0.3.8"
)
version
.
openapi_schema
[
"components"
][
"schemas"
][
"Output"
]
=
{
"type"
:
"array"
,
"items"
: {
"type"
:
"string"
},
"title"
:
"Output"
,
}
return
version
Back
|
FazBrowse Home
|
New Git URL