fffiloni commited on
Commit
fee438d
·
1 Parent(s): 132626b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -37,7 +37,17 @@ from urllib.request import urlretrieve
37
 
38
  from scipy.interpolate import LinearNDInterpolator
39
  from imageio import imread, imwrite
 
40
 
 
 
 
 
 
 
 
 
 
41
 
42
  def write_flo(flow, filename):
43
  """
 
37
 
38
  from scipy.interpolate import LinearNDInterpolator
39
  from imageio import imread, imwrite
40
+ from diffusers import StableDiffusionImg2ImgPipeline
41
 
42
+ def diffuse(source_img, prompt):
43
+ model_id = "runwayml/stable-diffusion-v1-5"
44
+ pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
45
+ pipe = pipe.to("cuda")
46
+
47
+ prompt = "space crew in a spaceship by Claude Monet"
48
+ image = pipe(prompt, source_img).images[0]
49
+ print(f"DIFFUSED IMG: {image}")
50
+ image.save("astronaut_rides_horse.png")
51
 
52
  def write_flo(flow, filename):
53
  """