zylim0702 / bokeh_prediction
Bokeh Prediction, a hybrid bokeh rendering framework that combines a neural renderer with a classical approach. It generates high-resolution, adjustable bokeh effects from a single image and potentially imperfect disparity maps.
Prediction
zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245IDhrctkglblndlyinazsjvlbbjbqStatusSucceededSourceWebHardwareA40Total durationCreatedInput
{ "K": 20, "focus": 0.87, "image": "https://replicate.delivery/pbxt/KIwMwjiIssQuFO7dAFO9X8hZOZSNmbpUlrGh0WRFH4oTuvhK/If-Elon-Musk-Had-Been-a-Happy-Child%2C-Would-He-Still-Be-Launching-Rockets--Business-Redux-h_16082330.webp" }
Install Replicate’s Node.js client library:npm install replicate
Import and set up the client:import Replicate from "replicate"; const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN, });
Run zylim0702/bokeh_prediction using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run( "zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245", { input: { K: 20, focus: 0.87, image: "https://replicate.delivery/pbxt/KIwMwjiIssQuFO7dAFO9X8hZOZSNmbpUlrGh0WRFH4oTuvhK/If-Elon-Musk-Had-Been-a-Happy-Child%2C-Would-He-Still-Be-Launching-Rockets--Business-Redux-h_16082330.webp" } } ); // 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.
Install Replicate’s Python client library:pip install replicate
Import the client:import replicate
Run zylim0702/bokeh_prediction using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run( "zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245", input={ "K": 20, "focus": 0.87, "image": "https://replicate.delivery/pbxt/KIwMwjiIssQuFO7dAFO9X8hZOZSNmbpUlrGh0WRFH4oTuvhK/If-Elon-Musk-Had-Been-a-Happy-Child%2C-Would-He-Still-Be-Launching-Rockets--Business-Redux-h_16082330.webp" } ) print(output)
To learn more, take a look at the guide on getting started with Python.
Run zylim0702/bokeh_prediction 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": "zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245", "input": { "K": 20, "focus": 0.87, "image": "https://replicate.delivery/pbxt/KIwMwjiIssQuFO7dAFO9X8hZOZSNmbpUlrGh0WRFH4oTuvhK/If-Elon-Musk-Had-Been-a-Happy-Child%2C-Would-He-Still-Be-Launching-Rockets--Business-Redux-h_16082330.webp" } }' \ https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
You can run this model locally using Cog. First, install Cog: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/zylim0702/bokeh_prediction@sha256:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245 \ -i 'K=20' \ -i 'focus=0.87' \ -i 'image="https://replicate.delivery/pbxt/KIwMwjiIssQuFO7dAFO9X8hZOZSNmbpUlrGh0WRFH4oTuvhK/If-Elon-Musk-Had-Been-a-Happy-Child%2C-Would-He-Still-Be-Launching-Rockets--Business-Redux-h_16082330.webp"'
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/zylim0702/bokeh_prediction@sha256:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245
curl -s -X POST \ -H "Content-Type: application/json" \ -d $'{ "input": { "K": 20, "focus": 0.87, "image": "https://replicate.delivery/pbxt/KIwMwjiIssQuFO7dAFO9X8hZOZSNmbpUlrGh0WRFH4oTuvhK/If-Elon-Musk-Had-Been-a-Happy-Child%2C-Would-He-Still-Be-Launching-Rockets--Business-Redux-h_16082330.webp" } }' \ http://localhost:5000/predictions
To learn more, take a look at the Cog documentation.
Output
{ "completed_at": "2024-01-28T10:54:14.707806Z", "created_at": "2024-01-28T10:53:49.875022Z", "data_removed": false, "error": null, "id": "hrctkglblndlyinazsjvlbbjbq", "input": { "K": 20, "focus": 0.87, "image": "https://replicate.delivery/pbxt/KIwMwjiIssQuFO7dAFO9X8hZOZSNmbpUlrGh0WRFH4oTuvhK/If-Elon-Musk-Had-Been-a-Happy-Child%2C-Would-He-Still-Be-Launching-Rockets--Business-Redux-h_16082330.webp" }, "logs": "tmp/bokeh_neural.png", "metrics": { "predict_time": 24.277789, "total_time": 24.832784 }, "output": "https://replicate.delivery/pbxt/VS6djQDg2WrYGl5B7p237FfNCjaNMY42aFzrZFDwTAtqIfQSA/bokeh_neural.png", "started_at": "2024-01-28T10:53:50.430017Z", "status": "succeeded", "urls": { "get": "https://api.replicate.com/v1/predictions/hrctkglblndlyinazsjvlbbjbq", "cancel": "https://api.replicate.com/v1/predictions/hrctkglblndlyinazsjvlbbjbq/cancel" }, "version": "1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245" }
Generated intmp/bokeh_neural.png
Prediction
zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245IDgglvtidbvgi3d2zb2geuj6reiaStatusSucceededSourceWebHardwareA40Total durationCreatedInput
{ "K": 30, "focus": 0.541, "image": "https://replicate.delivery/pbxt/KIwXxei39bry8699fIcNcsjvIT8oYlgLLcg0vZkERgvA0sdD/photo-composition-e1597393995467-797x1024.jpg", "x_coord_focus": 0, "y_coord_focus": 0 }
Install Replicate’s Node.js client library:npm install replicate
Import and set up the client:import Replicate from "replicate"; const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN, });
Run zylim0702/bokeh_prediction using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run( "zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245", { input: { K: 30, focus: 0.541, image: "https://replicate.delivery/pbxt/KIwXxei39bry8699fIcNcsjvIT8oYlgLLcg0vZkERgvA0sdD/photo-composition-e1597393995467-797x1024.jpg", x_coord_focus: 0, y_coord_focus: 0 } } ); // 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.
Install Replicate’s Python client library:pip install replicate
Import the client:import replicate
Run zylim0702/bokeh_prediction using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run( "zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245", input={ "K": 30, "focus": 0.541, "image": "https://replicate.delivery/pbxt/KIwXxei39bry8699fIcNcsjvIT8oYlgLLcg0vZkERgvA0sdD/photo-composition-e1597393995467-797x1024.jpg", "x_coord_focus": 0, "y_coord_focus": 0 } ) print(output)
To learn more, take a look at the guide on getting started with Python.
Run zylim0702/bokeh_prediction 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": "zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245", "input": { "K": 30, "focus": 0.541, "image": "https://replicate.delivery/pbxt/KIwXxei39bry8699fIcNcsjvIT8oYlgLLcg0vZkERgvA0sdD/photo-composition-e1597393995467-797x1024.jpg", "x_coord_focus": 0, "y_coord_focus": 0 } }' \ https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
You can run this model locally using Cog. First, install Cog: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/zylim0702/bokeh_prediction@sha256:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245 \ -i 'K=30' \ -i 'focus=0.541' \ -i 'image="https://replicate.delivery/pbxt/KIwXxei39bry8699fIcNcsjvIT8oYlgLLcg0vZkERgvA0sdD/photo-composition-e1597393995467-797x1024.jpg"' \ -i 'x_coord_focus=0' \ -i 'y_coord_focus=0'
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/zylim0702/bokeh_prediction@sha256:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245
curl -s -X POST \ -H "Content-Type: application/json" \ -d $'{ "input": { "K": 30, "focus": 0.541, "image": "https://replicate.delivery/pbxt/KIwXxei39bry8699fIcNcsjvIT8oYlgLLcg0vZkERgvA0sdD/photo-composition-e1597393995467-797x1024.jpg", "x_coord_focus": 0, "y_coord_focus": 0 } }' \ http://localhost:5000/predictions
To learn more, take a look at the Cog documentation.
Output
{ "completed_at": "2024-01-28T11:06:04.968679Z", "created_at": "2024-01-28T11:05:28.551180Z", "data_removed": false, "error": null, "id": "gglvtidbvgi3d2zb2geuj6reia", "input": { "K": 30, "focus": 0.541, "image": "https://replicate.delivery/pbxt/KIwXxei39bry8699fIcNcsjvIT8oYlgLLcg0vZkERgvA0sdD/photo-composition-e1597393995467-797x1024.jpg", "x_coord_focus": 0, "y_coord_focus": 0 }, "logs": "/root/.pyenv/versions/3.8.18/lib/python3.8/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]\ntmp/bokeh_neural.png", "metrics": { "predict_time": 16.675782, "total_time": 36.417499 }, "output": "https://replicate.delivery/pbxt/tb6Leh4OUcQmH6rK6KffHy16bXXwR6GoPTQyaaWoN04248hkA/bokeh_neural.png", "started_at": "2024-01-28T11:05:48.292897Z", "status": "succeeded", "urls": { "get": "https://api.replicate.com/v1/predictions/gglvtidbvgi3d2zb2geuj6reia", "cancel": "https://api.replicate.com/v1/predictions/gglvtidbvgi3d2zb2geuj6reia/cancel" }, "version": "1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245" }
Generated in/root/.pyenv/versions/3.8.18/lib/python3.8/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] tmp/bokeh_neural.png
Prediction
zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245IDn6dsrldb3m2nd4o3qs6wohubp4StatusSucceededSourceWebHardwareA40Total durationCreatedInput
{ "K": 15, "focus": 0.737, "image": "https://replicate.delivery/pbxt/KIwdlX1gKza1A6GseRPGxEvjg9HV3oP1fYJAdTBMvRtNE1ik/1706440137224.jpg", "x_coord_focus": 0, "y_coord_focus": 0 }
Install Replicate’s Node.js client library:npm install replicate
Import and set up the client:import Replicate from "replicate"; const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN, });
Run zylim0702/bokeh_prediction using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run( "zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245", { input: { K: 15, focus: 0.737, image: "https://replicate.delivery/pbxt/KIwdlX1gKza1A6GseRPGxEvjg9HV3oP1fYJAdTBMvRtNE1ik/1706440137224.jpg", x_coord_focus: 0, y_coord_focus: 0 } } ); // 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.
Install Replicate’s Python client library:pip install replicate
Import the client:import replicate
Run zylim0702/bokeh_prediction using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run( "zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245", input={ "K": 15, "focus": 0.737, "image": "https://replicate.delivery/pbxt/KIwdlX1gKza1A6GseRPGxEvjg9HV3oP1fYJAdTBMvRtNE1ik/1706440137224.jpg", "x_coord_focus": 0, "y_coord_focus": 0 } ) print(output)
To learn more, take a look at the guide on getting started with Python.
Run zylim0702/bokeh_prediction 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": "zylim0702/bokeh_prediction:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245", "input": { "K": 15, "focus": 0.737, "image": "https://replicate.delivery/pbxt/KIwdlX1gKza1A6GseRPGxEvjg9HV3oP1fYJAdTBMvRtNE1ik/1706440137224.jpg", "x_coord_focus": 0, "y_coord_focus": 0 } }' \ https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
You can run this model locally using Cog. First, install Cog: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/zylim0702/bokeh_prediction@sha256:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245 \ -i 'K=15' \ -i 'focus=0.737' \ -i 'image="https://replicate.delivery/pbxt/KIwdlX1gKza1A6GseRPGxEvjg9HV3oP1fYJAdTBMvRtNE1ik/1706440137224.jpg"' \ -i 'x_coord_focus=0' \ -i 'y_coord_focus=0'
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/zylim0702/bokeh_prediction@sha256:1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245
curl -s -X POST \ -H "Content-Type: application/json" \ -d $'{ "input": { "K": 15, "focus": 0.737, "image": "https://replicate.delivery/pbxt/KIwdlX1gKza1A6GseRPGxEvjg9HV3oP1fYJAdTBMvRtNE1ik/1706440137224.jpg", "x_coord_focus": 0, "y_coord_focus": 0 } }' \ http://localhost:5000/predictions
To learn more, take a look at the Cog documentation.
Output
{ "completed_at": "2024-01-28T11:11:56.481765Z", "created_at": "2024-01-28T11:11:35.689370Z", "data_removed": false, "error": null, "id": "n6dsrldb3m2nd4o3qs6wohubp4", "input": { "K": 15, "focus": 0.737, "image": "https://replicate.delivery/pbxt/KIwdlX1gKza1A6GseRPGxEvjg9HV3oP1fYJAdTBMvRtNE1ik/1706440137224.jpg", "x_coord_focus": 0, "y_coord_focus": 0 }, "logs": "tmp/bokeh_neural.png", "metrics": { "predict_time": 19.824126, "total_time": 20.792395 }, "output": "https://replicate.delivery/pbxt/DjEC0591nMqzO1nLEQNTNNeu4EG8mVnHqTD7pSdoEet2hehkA/bokeh_neural.png", "started_at": "2024-01-28T11:11:36.657639Z", "status": "succeeded", "urls": { "get": "https://api.replicate.com/v1/predictions/n6dsrldb3m2nd4o3qs6wohubp4", "cancel": "https://api.replicate.com/v1/predictions/n6dsrldb3m2nd4o3qs6wohubp4/cancel" }, "version": "1d2a4698106b7a7091b43467aeb1219f3ce329181c9daef45368ec37953fb245" }
Generated intmp/bokeh_neural.png
Want to make some of these yourself?
Run this model