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

Author a user prompt for impromptu generation #5

Open
2 tasks
pramitchoudhary opened this issue Sep 29, 2022 · 1 comment
Open
2 tasks

Author a user prompt for impromptu generation #5

pramitchoudhary opened this issue Sep 29, 2022 · 1 comment
Assignees
Labels
type/feature Feature request

Comments

@pramitchoudhary
Copy link
Member

pramitchoudhary commented Sep 29, 2022

Guided impromptu generation using Stable Diffuse

import requests
import torch
from torch import autocast
from PIL import Image
from io import BytesIO
from diffusers import StableDiffusionImg2ImgPipeline

# Upload image
from PIL import Image
image_input = Image.open("...").convert("RGB")
init_image = image_input.resize((768, 512))

device = "cuda"
model_id_or_path = "CompVis/stable-diffusion-v1-4"
pipe = StableDiffusionImg2ImgPipeline.from_pretrained("../diffuser_fun/stable-diffusion-v1-4"
pipe = pipe.to(device)

prompt = "oil painting"
with autocast(device):
    images = pipe(prompt=prompt, init_image=init_image, strength=0.75, guidance_scale=7.5)["sample"]

images[0].save("oil_paiting.png")


from matplotlib.pyplot import imshow
import numpy as np
%matplotlib inline

pil_im = Image.open('oil_paiting.png', 'r')
imshow(np.asarray(pil_im))
  • With re-training to customize
pramitchoudhary added a commit that referenced this issue Oct 17, 2022
@pramitchoudhary pramitchoudhary self-assigned this Oct 20, 2022
@pramitchoudhary
Copy link
Member Author

Screen Shot 2022-10-20 at 12 27 59 AM

pramitchoudhary added a commit that referenced this issue Oct 31, 2022
pramitchoudhary added a commit that referenced this issue Oct 31, 2022
pramitchoudhary added a commit that referenced this issue Oct 31, 2022
pramitchoudhary added a commit that referenced this issue Oct 31, 2022
pramitchoudhary added a commit that referenced this issue Oct 31, 2022
pramitchoudhary added a commit that referenced this issue Nov 1, 2022
pramitchoudhary added a commit that referenced this issue Nov 1, 2022
pramitchoudhary added a commit that referenced this issue Nov 7, 2022
pramitchoudhary added a commit that referenced this issue Nov 7, 2022
@pramitchoudhary pramitchoudhary added the type/feature Feature request label Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature Feature request
Projects
None yet
Development

No branches or pull requests

1 participant