Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions replicate/prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class Prediction(Resource):
id: str
"""The unique ID of the prediction."""

model: str
"""An identifier for the model used to create the prediction, in the form `owner/name`."""

version: str
"""An identifier for the version of the model used to create the prediction."""

Expand Down
3 changes: 3 additions & 0 deletions replicate/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class Training(Resource):
id: str
"""The unique ID of the training."""

model: str
"""An identifier for the model used to create the prediction, in the form `owner/name`."""

version: Union[str, Version]
"""The version of the model used to create the training."""

Expand Down
9,330 changes: 83 additions & 9,247 deletions tests/cassettes/collections-get.yaml

Large diffs are not rendered by default.

173 changes: 14 additions & 159 deletions tests/cassettes/collections-list.yaml
Original file line number Diff line number Diff line change
@@ -1,148 +1,4 @@
interactions:
- request:
body: ''
headers:
accept:
- '*/*'
accept-encoding:
- gzip, deflate
connection:
- keep-alive
host:
- api.replicate.com
user-agent:
- replicate-python/0.15.6
method: GET
uri: https://api.replicate.com/collections
response:
content: "response 404 (backend NotFound), service rules for the path non-existent
\n"
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 82253fddaa5630b7-SEA
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- text/plain; charset=utf-8
Date:
- Tue, 07 Nov 2023 11:31:21 GMT
NEL:
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
Report-To:
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=uQfbIfp7jcTaOeMfw6BHB2jikbc2CC%2Fg96weVmmeYXUm5SblRi9QlWrSJVrVOzpUKMRTMYPJqlqXfeb57%2B19Sp%2BRjAejz94aldajmm3w%2F7dzpOL4rEebSCnushZtGz9ZDRbC"}],"group":"cf-nel","max_age":604800}'
Server:
- cloudflare
Strict-Transport-Security:
- max-age=15552000
Transfer-Encoding:
- chunked
via:
- 1.1 google
http_version: HTTP/1.1
status_code: 404
- request:
body: ''
headers:
accept:
- '*/*'
accept-encoding:
- gzip, deflate
connection:
- keep-alive
host:
- api.replicate.com
user-agent:
- replicate-python/0.15.6
method: GET
uri: https://api.replicate.com/v1/collections
response:
content: '{"next":null,"previous":null,"results":[{"name":"Halloween","slug":"halloween","description":"Spooky,
scary, frightful models."},{"name":"Vision models","slug":"vision-models","description":"Multimodal
large language models with vision capabilities like object detection and optical
character recognition (OCR)"},{"name":"T2I-Adapter","slug":"t2i-adapter","description":"T2I-Adapter
models to modify images"},{"name":"Language models with support for grammars
and jsonschema","slug":"language-models-with-grammar","description":"Language
models that support grammar-based decoding as well as jsonschema constraints."},{"name":"SDXL
fine-tunes","slug":"sdxl-fine-tunes","description":"Some of our favorite SDXL
fine-tunes."},{"name":"Streaming language models","slug":"streaming-language-models","description":"Language
models that support streaming responses. See https://replicate.com/docs/streaming"},{"name":"Image
editing","slug":"image-editing","description":"Tools for manipulating images."},{"name":"Embedding
models","slug":"embedding-models","description":"Models that generate embeddings
from inputs"},{"name":"Trainable language models","slug":"trainable-language-models","description":"Language
models that you can fine-tune using Replicate''s training API."},{"name":"Language
models","slug":"language-models","description":"Models that can understand and
generate text"},{"name":"ControlNet","slug":"control-net","description":"Control
diffusion models"},{"name":"Audio generation","slug":"audio-generation","description":"Models
to generate and modify audio"},{"name":"Diffusion models","slug":"diffusion-models","description":"Image
and video generation models trained with diffusion processes"},{"name":"Videos","slug":"text-to-video","description":"Models
that create and edit videos"},{"name":"Image to text","slug":"image-to-text","description":"Models
that generate text prompts and captions from images"},{"name":"Super resolution","slug":"super-resolution","description":"Upscaling
models that create high-quality images from low-quality images"},{"name":"Style
transfer","slug":"style-transfer","description":"Models that take a content
image and a style reference to produce a new image"},{"name":"ML makeovers","slug":"ml-makeovers","description":"Models
that let you change facial features"},{"name":"Image restoration","slug":"image-restoration","description":"Models
that improve or restore images by deblurring, colorization, and removing noise"},{"name":"Text
to image","slug":"text-to-image","description":"Models that generate images
from text prompts"}]}'
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 822540d7cb34c36c-SEA
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Tue, 07 Nov 2023 11:32:02 GMT
Server:
- cloudflare
Strict-Transport-Security:
- max-age=15552000
Transfer-Encoding:
- chunked
allow:
- GET, HEAD, OPTIONS
content-security-policy-report-only:
- 'style-src ''report-sample'' ''self'' ''unsafe-inline''; img-src ''report-sample''
''self'' data: https://replicate.delivery https://*.replicate.delivery https://*.githubusercontent.com
https://github.com; default-src ''self''; media-src ''report-sample'' ''self''
https://replicate.delivery https://*.replicate.delivery https://*.mux.com
https://*.sentry.io; font-src ''report-sample'' ''self'' data:; connect-src
''report-sample'' ''self'' https://replicate.delivery https://*.replicate.delivery
https://*.rudderlabs.com https://*.rudderstack.com https://*.mux.com https://*.sentry.io;
script-src ''report-sample'' ''self'' https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js;
worker-src ''none''; report-uri'
cross-origin-opener-policy:
- same-origin
nel:
- '{"report_to":"heroku-nel","max_age":3600,"success_fraction":0.005,"failure_fraction":0.05,"response_headers":["Via"]}'
ratelimit-remaining:
- '2999'
ratelimit-reset:
- '1'
referrer-policy:
- same-origin
report-to:
- '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1699356722&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=0z31nJbfdkKAzOcUMFWyBfoSPkxX%2ByLKhN0THsH1yz0%3D"}]}'
reporting-endpoints:
- heroku-nel=https://nel.heroku.com/reports?ts=1699356722&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=0z31nJbfdkKAzOcUMFWyBfoSPkxX%2ByLKhN0THsH1yz0%3D
vary:
- Cookie, origin
via:
- 1.1 vegur, 1.1 google
x-content-type-options:
- nosniff
x-frame-options:
- DENY
http_version: HTTP/1.1
status_code: 200
- request:
body: ''
headers:
Expand All @@ -159,8 +15,7 @@ interactions:
method: GET
uri: https://api.replicate.com/v1/collections
response:
content: '{"next":null,"previous":null,"results":[{"name":"Halloween","slug":"halloween","description":"Spooky,
scary, frightful models."},{"name":"Vision models","slug":"vision-models","description":"Multimodal
content: '{"next":null,"previous":null,"results":[{"name":"Vision models","slug":"vision-models","description":"Multimodal
large language models with vision capabilities like object detection and optical
character recognition (OCR)"},{"name":"T2I-Adapter","slug":"t2i-adapter","description":"T2I-Adapter
models to modify images"},{"name":"Language models with support for grammars
Expand Down Expand Up @@ -191,15 +46,15 @@ interactions:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 822541955c92680f-SEA
- 827025392eae200a-IAD
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Tue, 07 Nov 2023 11:32:32 GMT
- Thu, 16 Nov 2023 13:40:22 GMT
Server:
- cloudflare
Strict-Transport-Security:
Expand All @@ -209,15 +64,15 @@ interactions:
allow:
- GET, HEAD, OPTIONS
content-security-policy-report-only:
- 'style-src ''report-sample'' ''self'' ''unsafe-inline''; script-src ''report-sample''
''self'' https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js; worker-src
''none''; font-src ''report-sample'' ''self'' data:; media-src ''report-sample''
''self'' https://replicate.delivery https://*.replicate.delivery https://*.mux.com
https://*.sentry.io; default-src ''self''; connect-src ''report-sample'' ''self''
https://replicate.delivery https://*.replicate.delivery https://*.rudderlabs.com
https://*.rudderstack.com https://*.mux.com https://*.sentry.io; img-src ''report-sample''
''self'' data: https://replicate.delivery https://*.replicate.delivery https://*.githubusercontent.com
https://github.com; report-uri'
- 'media-src ''report-sample'' ''self'' https://replicate.delivery https://*.replicate.delivery
https://*.mux.com https://*.sentry.io; default-src ''self''; script-src ''report-sample''
''self'' https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js; img-src
''report-sample'' ''self'' data: https://replicate.delivery https://*.replicate.delivery
https://*.githubusercontent.com https://github.com; worker-src ''none''; style-src
''report-sample'' ''self'' ''unsafe-inline''; connect-src ''report-sample''
''self'' https://replicate.delivery https://*.replicate.delivery https://*.rudderlabs.com
https://*.rudderstack.com https://*.mux.com https://*.sentry.io; font-src
''report-sample'' ''self'' data:; report-uri'
cross-origin-opener-policy:
- same-origin
nel:
Expand All @@ -229,9 +84,9 @@ interactions:
referrer-policy:
- same-origin
report-to:
- '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1699356752&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=WiktulKoNTILUBzFp2puv8yuZR7cPZG%2BdC77SDgv8Gw%3D"}]}'
- '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1700142022&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=AUQIFO072WbZjKq785Xqd67vUUwGAhLFqu5%2BlLug%2BWE%3D"}]}'
reporting-endpoints:
- heroku-nel=https://nel.heroku.com/reports?ts=1699356752&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=WiktulKoNTILUBzFp2puv8yuZR7cPZG%2BdC77SDgv8Gw%3D
- heroku-nel=https://nel.heroku.com/reports?ts=1700142022&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=AUQIFO072WbZjKq785Xqd67vUUwGAhLFqu5%2BlLug%2BWE%3D
vary:
- Cookie, origin
via:
Expand Down
61 changes: 32 additions & 29 deletions tests/cassettes/models-get.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interactions:
"name": "sdxl", "description": "A text-to-image generative AI model that creates
beautiful images", "visibility": "public", "github_url": "https://github.com/replicate/cog-sdxl",
"paper_url": "https://arxiv.org/abs/2307.01952", "license_url": "https://github.com/Stability-AI/generative-models/blob/main/model_licenses/LICENSE-SDXL1.0",
"run_count": 16656495, "cover_image_url": "https://tjzk.replicate.delivery/models_models_cover_image/61004930-fb88-4e09-9bd4-74fd8b4aa677/sdxl_cover.png",
"run_count": 19361490, "cover_image_url": "https://tjzk.replicate.delivery/models_models_cover_image/61004930-fb88-4e09-9bd4-74fd8b4aa677/sdxl_cover.png",
"default_example": {"completed_at": "2023-10-12T17:10:12.909279Z", "created_at":
"2023-10-12T17:10:07.956869Z", "error": null, "id": "dzsqmb3bg4lqpjkz2iptjqgccm",
"input": {"width": 768, "height": 768, "prompt": "An astronaut riding a rainbow
Expand Down Expand Up @@ -52,7 +52,7 @@ interactions:
"started_at": "2023-10-12T17:10:07.927942Z", "status": "succeeded", "urls":
{"get": "https://api.replicate.com/v1/predictions/dzsqmb3bg4lqpjkz2iptjqgccm",
"cancel": "https://api.replicate.com/v1/predictions/dzsqmb3bg4lqpjkz2iptjqgccm/cancel"},
"version": "c221b2b8ef527988fb59bf24a8b97c4561f1c671f73bd389f866bfb27c061316",
"model": "stability-ai/sdxl", "version": "c221b2b8ef527988fb59bf24a8b97c4561f1c671f73bd389f866bfb27c061316",
"webhook_completed": null}, "latest_version": {"id": "39ed52f2a78e934b3ba6e2a89f5b1c712de7dfea535525255b1aa35c5565e08b",
"created_at": "2023-11-06T23:13:07.906314Z", "cog_version": "0.8.6", "openapi_schema":
{"info": {"title": "Cog", "version": "0.1.0"}, "paths": {"/": {"get": {"summary":
Expand Down Expand Up @@ -170,15 +170,15 @@ interactions:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 8225cc4959f1c382-SEA
- 82702682c85e3afa-IAD
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Tue, 07 Nov 2023 13:07:13 GMT
- Thu, 16 Nov 2023 13:41:15 GMT
Server:
- cloudflare
Strict-Transport-Security:
Expand All @@ -188,14 +188,15 @@ interactions:
allow:
- GET, HEAD, OPTIONS
content-security-policy-report-only:
- 'style-src ''report-sample'' ''self'' ''unsafe-inline''; connect-src ''report-sample''
''self'' https://replicate.delivery https://*.replicate.delivery https://*.rudderlabs.com
https://*.rudderstack.com https://*.mux.com https://*.sentry.io; font-src
''report-sample'' ''self'' data:; script-src ''report-sample'' ''self'' https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js;
worker-src ''none''; img-src ''report-sample'' ''self'' data: https://replicate.delivery
https://*.replicate.delivery https://*.githubusercontent.com https://github.com;
default-src ''self''; media-src ''report-sample'' ''self'' https://replicate.delivery
https://*.replicate.delivery https://*.mux.com https://*.sentry.io; report-uri'
- 'img-src ''report-sample'' ''self'' data: https://replicate.delivery https://*.replicate.delivery
https://*.githubusercontent.com https://github.com; style-src ''report-sample''
''self'' ''unsafe-inline''; font-src ''report-sample'' ''self'' data:; worker-src
''none''; connect-src ''report-sample'' ''self'' https://replicate.delivery
https://*.replicate.delivery https://*.rudderlabs.com https://*.rudderstack.com
https://*.mux.com https://*.sentry.io; default-src ''self''; media-src ''report-sample''
''self'' https://replicate.delivery https://*.replicate.delivery https://*.mux.com
https://*.sentry.io; script-src ''report-sample'' ''self'' https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js;
report-uri'
cross-origin-opener-policy:
- same-origin
nel:
Expand All @@ -207,9 +208,9 @@ interactions:
referrer-policy:
- same-origin
report-to:
- '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1699362433&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=zH5RNbbfmwMdjyaSsKchIOr55KExVjfjhKt6gPsWVzI%3D"}]}'
- '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1700142075&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=6G1BMZHhXTEFBJa1qOIwI2LAhE2J3ob6Pd87SpjKM5w%3D"}]}'
reporting-endpoints:
- heroku-nel=https://nel.heroku.com/reports?ts=1699362433&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=zH5RNbbfmwMdjyaSsKchIOr55KExVjfjhKt6gPsWVzI%3D
- heroku-nel=https://nel.heroku.com/reports?ts=1700142075&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=6G1BMZHhXTEFBJa1qOIwI2LAhE2J3ob6Pd87SpjKM5w%3D
vary:
- Cookie, origin
via:
Expand Down Expand Up @@ -244,19 +245,15 @@ interactions:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 8225cc4b0b64c382-SEA
- 82702683c99c3afa-IAD
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Tue, 07 Nov 2023 13:07:13 GMT
NEL:
- '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
Report-To:
- '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=cY2nl%2FrK5utZBgfjK1IykTazkguXz8LHTFFt9E8eHHnk6RqonDn2KHLyZYVxBTMJkyUMtdWMrR48N0MqqF20iMqcZWpeQ0gnvSZnKnmoGQe2xJECyJcKRanwdFJy29fBHigz"}],"group":"cf-nel","max_age":604800}'
- Thu, 16 Nov 2023 13:41:15 GMT
Server:
- cloudflare
Strict-Transport-Security:
Expand All @@ -266,23 +263,29 @@ interactions:
allow:
- GET, HEAD, OPTIONS
content-security-policy-report-only:
- 'script-src ''report-sample'' ''self'' https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js;
style-src ''report-sample'' ''self'' ''unsafe-inline''; default-src ''self'';
font-src ''report-sample'' ''self'' data:; img-src ''report-sample'' ''self''
data: https://replicate.delivery https://*.replicate.delivery https://*.githubusercontent.com
https://github.com; connect-src ''report-sample'' ''self'' https://replicate.delivery
https://*.replicate.delivery https://*.rudderlabs.com https://*.rudderstack.com
https://*.mux.com https://*.sentry.io; media-src ''report-sample'' ''self''
https://replicate.delivery https://*.replicate.delivery https://*.mux.com
https://*.sentry.io; worker-src ''none''; report-uri'
- 'media-src ''report-sample'' ''self'' https://replicate.delivery https://*.replicate.delivery
https://*.mux.com https://*.sentry.io; default-src ''self''; script-src ''report-sample''
''self'' https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js; img-src
''report-sample'' ''self'' data: https://replicate.delivery https://*.replicate.delivery
https://*.githubusercontent.com https://github.com; worker-src ''none''; style-src
''report-sample'' ''self'' ''unsafe-inline''; connect-src ''report-sample''
''self'' https://replicate.delivery https://*.replicate.delivery https://*.rudderlabs.com
https://*.rudderstack.com https://*.mux.com https://*.sentry.io; font-src
''report-sample'' ''self'' data:; report-uri'
cross-origin-opener-policy:
- same-origin
nel:
- '{"report_to":"heroku-nel","max_age":3600,"success_fraction":0.005,"failure_fraction":0.05,"response_headers":["Via"]}'
ratelimit-remaining:
- '2999'
ratelimit-reset:
- '1'
referrer-policy:
- same-origin
report-to:
- '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1700142075&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=6G1BMZHhXTEFBJa1qOIwI2LAhE2J3ob6Pd87SpjKM5w%3D"}]}'
reporting-endpoints:
- heroku-nel=https://nel.heroku.com/reports?ts=1700142075&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=6G1BMZHhXTEFBJa1qOIwI2LAhE2J3ob6Pd87SpjKM5w%3D
vary:
- Cookie, origin
via:
Expand Down
Loading