You're looking at a specific version of this model. Jump to the model overview.
Input
Run this model in Node.js with one line of code:
npm install replicate
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run cjwbw/resshift using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"cjwbw/resshift:3592f9923723132ea2da2209ca8762f030c52b06b9c2d8f709cd4fa97187d201",
{
input: {
task: "realsrx4",
image: "https://replicate.delivery/pbxt/JHFWRZMpgOu7jvS2Ag6pj7vXOdjJx2zYkKcqDpiVwcOp7gcx/comic1.png",
scale: 4,
chop_size: 512
}
}
);
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
import replicate
Run cjwbw/resshift using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"cjwbw/resshift:3592f9923723132ea2da2209ca8762f030c52b06b9c2d8f709cd4fa97187d201",
input={
"task": "realsrx4",
"image": "https://replicate.delivery/pbxt/JHFWRZMpgOu7jvS2Ag6pj7vXOdjJx2zYkKcqDpiVwcOp7gcx/comic1.png",
"scale": 4,
"chop_size": 512
}
)
print(output)
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
Run cjwbw/resshift using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"version": "cjwbw/resshift:3592f9923723132ea2da2209ca8762f030c52b06b9c2d8f709cd4fa97187d201",
"input": {
"task": "realsrx4",
"image": "https://replicate.delivery/pbxt/JHFWRZMpgOu7jvS2Ag6pj7vXOdjJx2zYkKcqDpiVwcOp7gcx/comic1.png",
"scale": 4,
"chop_size": 512
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
brew install cog
If you don’t have Homebrew, there are other installation options available.
Run this to download the model and run it in your local environment:
cog predict r8.im/chenxwh/resshift@sha256:3592f9923723132ea2da2209ca8762f030c52b06b9c2d8f709cd4fa97187d201 \
-i 'task="realsrx4"' \
-i 'image="https://replicate.delivery/pbxt/JHFWRZMpgOu7jvS2Ag6pj7vXOdjJx2zYkKcqDpiVwcOp7gcx/comic1.png"' \
-i 'scale=4' \
-i 'chop_size=512'
To learn more, take a look at the Cog documentation.
Run this to download the model and run it in your local environment:
docker run -d -p 5000:5000 --gpus=all r8.im/chenxwh/resshift@sha256:3592f9923723132ea2da2209ca8762f030c52b06b9c2d8f709cd4fa97187d201
curl -s -X POST \ -H "Content-Type: application/json" \ -d $'{ "input": { "task": "realsrx4", "image": "https://replicate.delivery/pbxt/JHFWRZMpgOu7jvS2Ag6pj7vXOdjJx2zYkKcqDpiVwcOp7gcx/comic1.png", "scale": 4, "chop_size": 512 } }' \ http://localhost:5000/predictions
To learn more, take a look at the Cog documentation.
Add a payment method to run this model.
Each run costs approximately $0.016. Alternatively, try out our featured models for free.
By signing in, you agree to our
terms of service and privacy policy
Output
{
"completed_at": "2023-08-02T00:34:20.345570Z",
"created_at": "2023-08-02T00:29:30.678031Z",
"data_removed": false,
"error": null,
"id": "yalg4erbhlwiivvc677feeku2y",
"input": {
"task": "realsrx4",
"image": "https://replicate.delivery/pbxt/JHFWRZMpgOu7jvS2Ag6pj7vXOdjJx2zYkKcqDpiVwcOp7gcx/comic1.png",
"scale": 4,
"chop_size": 512
},
"logs": "Using seed: 52573\nBuilding the diffusion model with length: 15...\n/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3483.)\nreturn _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]\nLoading Diffusion model from weights/resshift_realsrx4_s15.pth...\nLoading AutoEncoder model from weights/autoencoder_vq_f4.pth...\nbuilding MemoryEfficientAttnBlock with 512 in_channels...\nWorking with z of shape (1, 3, 64, 64) = 12288 dimensions.\nbuilding MemoryEfficientAttnBlock with 512 in_channels...\nProcessing done, enjoy the results in out_dir",
"metrics": {
"predict_time": 19.834865,
"total_time": 289.667539
},
"output": "https://replicate.delivery/pbxt/X0SlhKOZssZfcKYch1J7IL1oEjvrui1lXRc78d2gYrFGt6qIA/out.png",
"started_at": "2023-08-02T00:34:00.510705Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/yalg4erbhlwiivvc677feeku2y",
"cancel": "https://api.replicate.com/v1/predictions/yalg4erbhlwiivvc677feeku2y/cancel"
},
"version": "3592f9923723132ea2da2209ca8762f030c52b06b9c2d8f709cd4fa97187d201"
}
Using seed: 52573
Building the diffusion model with length: 15...
/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3483.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Loading Diffusion model from weights/resshift_realsrx4_s15.pth...
Loading AutoEncoder model from weights/autoencoder_vq_f4.pth...
building MemoryEfficientAttnBlock with 512 in_channels...
Working with z of shape (1, 3, 64, 64) = 12288 dimensions.
building MemoryEfficientAttnBlock with 512 in_channels...
Processing done, enjoy the results in out_dir