diff --git a/docs/user_guide/examples/online_serving/image_to_image.md b/docs/user_guide/examples/online_serving/image_to_image.md index 94d1cec90..0cf6339c4 100644 --- a/docs/user_guide/examples/online_serving/image_to_image.md +++ b/docs/user_guide/examples/online_serving/image_to_image.md @@ -46,24 +46,27 @@ bash run_curl_image_edit.sh input.png "Convert this image to watercolor style" # Or execute directly IMG_B64=$(base64 -w0 input.png) -curl -s http://localhost:8092/v1/chat/completions \ - -H "Content-Type: application/json" \ - -d "{ - \"messages\": [{ - \"role\": \"user\", - \"content\": [ - {\"type\": \"text\", \"text\": \"Convert this image to watercolor style\"}, - {\"type\": \"image_url\", \"image_url\": {\"url\": \"data:image/png;base64,\$IMG_B64\"}} - ] - }], - \"extra_body\": { - \"height\": 1024, - \"width\": 1024, - \"num_inference_steps\": 50, - \"guidance_scale\": 7.5, - \"seed\": 42 - } - }" | jq -r '.choices[0].message.content[0].image_url.url' | cut -d',' -f2 | base64 -d > output.png + +cat < request.json +{ + "messages": [{ + "role": "user", + "content": [ + {"type": "text", "text": "Convert this image to watercolor style"}, + {"type": "image_url", "image_url": {"url": "data:image/png;base64,$IMG_B64"}} + ] + }], + "extra_body": { + "height": 1024, + "width": 1024, + "num_inference_steps": 50, + "guidance_scale": 1, + "seed": 42 + } +} +EOF + +curl -s http://localhost:8092/v1/chat/completions -H "Content-Type: application/json" -d @request.json | jq -r '.choices[0].message.content[0].image_url.url' | cut -d',' -f2 | base64 -d > output.png ``` ### Method 2: Using Python Client diff --git a/examples/online_serving/image_to_image/README.md b/examples/online_serving/image_to_image/README.md index 097907c42..171a33680 100644 --- a/examples/online_serving/image_to_image/README.md +++ b/examples/online_serving/image_to_image/README.md @@ -43,24 +43,27 @@ bash run_curl_image_edit.sh input.png "Convert this image to watercolor style" # Or execute directly IMG_B64=$(base64 -w0 input.png) -curl -s http://localhost:8092/v1/chat/completions \ - -H "Content-Type: application/json" \ - -d "{ - \"messages\": [{ - \"role\": \"user\", - \"content\": [ - {\"type\": \"text\", \"text\": \"Convert this image to watercolor style\"}, - {\"type\": \"image_url\", \"image_url\": {\"url\": \"data:image/png;base64,\$IMG_B64\"}} - ] - }], - \"extra_body\": { - \"height\": 1024, - \"width\": 1024, - \"num_inference_steps\": 50, - \"guidance_scale\": 7.5, - \"seed\": 42 - } - }" | jq -r '.choices[0].message.content[0].image_url.url' | cut -d',' -f2 | base64 -d > output.png + +cat < request.json +{ + "messages": [{ + "role": "user", + "content": [ + {"type": "text", "text": "Convert this image to watercolor style"}, + {"type": "image_url", "image_url": {"url": "data:image/png;base64,$IMG_B64"}} + ] + }], + "extra_body": { + "height": 1024, + "width": 1024, + "num_inference_steps": 50, + "guidance_scale": 1, + "seed": 42 + } +} +EOF + +curl -s http://localhost:8092/v1/chat/completions -H "Content-Type: application/json" -d @request.json | jq -r '.choices[0].message.content[0].image_url.url' | cut -d',' -f2 | base64 -d > output.png ``` ### Method 2: Using Python Client