Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ControlNet example truss #265

Merged
merged 4 commits into from
Apr 13, 2023
Merged

Add ControlNet example truss #265

merged 4 commits into from
Apr 13, 2023

Conversation

spal1
Copy link
Collaborator

@spal1 spal1 commented Apr 13, 2023

This PR adds a ControlNet truss to the examples/ directory. This truss in particular is created for the sd-controlnet-scribble model.

Input images are expected to be PNGs serialized as base64 and output images are also PNGs serialized as base64.

Trusses can easily be made for the other StableDiffusionControlNetPipeline models listed here

You can test this truss by running the following:

import truss
from shared.base64_utils import b64_to_pil

controlnet_truss = truss.load("controlnet-scribble")

# The example uses this input image: https://huggingface.co/lllyasviel/sd-controlnet-scribble/resolve/main/images/bag.png
bag_input = controlnet_truss.example("bag example").input
response = controlnet_truss.docker_predict(bag_input)

# The outputted image will be saved as "bag_output.png"
b64_to_pil(response["images"][0]).save("bag_output.png")

@spal1 spal1 requested review from bolasim and joostinyi April 13, 2023 05:34
@bolasim
Copy link
Collaborator

bolasim commented Apr 13, 2023

Can you add this PR description to a README in that folder so people know how to use it?

@spal1 spal1 changed the title Add initial controlnet truss Add ControlNet example truss Apr 13, 2023
@spal1 spal1 requested a review from pankajroark April 13, 2023 17:58
Copy link
Collaborator

@joostinyi joostinyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested readme examples – working well

@spal1 spal1 merged commit bd4656b into main Apr 13, 2023
@spal1 spal1 deleted the samiksha/add-controlnet-truss branch April 13, 2023 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants