Update app.py
Browse files
app.py
CHANGED
@@ -37,18 +37,7 @@ from urllib.request import urlretrieve
|
|
37 |
|
38 |
from scipy.interpolate import LinearNDInterpolator
|
39 |
from imageio import imread, imwrite
|
40 |
-
from diffusers import StableDiffusionImg2ImgPipeline
|
41 |
|
42 |
-
model_id = "runwayml/stable-diffusion-v1-5"
|
43 |
-
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
44 |
-
pipe = pipe.to("cuda")
|
45 |
-
|
46 |
-
def diffuse(source_img):
|
47 |
-
source_img = Image.open(source_img)
|
48 |
-
prompt = "space crew in a spaceship by Claude Monet"
|
49 |
-
image = pipe(prompt, source_img).images[0]
|
50 |
-
print(f"DIFFUSED IMG: {image}")
|
51 |
-
image.save("astronaut_rides_horse.png")
|
52 |
|
53 |
def write_flo(flow, filename):
|
54 |
"""
|
@@ -85,8 +74,6 @@ def infer():
|
|
85 |
#frames, _, _ = read_video(str("./spacex.mp4"), output_format="TCHW")
|
86 |
#print(f"FRAME BEFORE stack: {frames[100]}")
|
87 |
|
88 |
-
#testing difusion working properly
|
89 |
-
diffuse("./frame1.jpg")
|
90 |
|
91 |
input_frame_1 = read_image(str("./frame1.jpg"), ImageReadMode.UNCHANGED)
|
92 |
print(f"FRAME 1: {input_frame_1}")
|
|
|
37 |
|
38 |
from scipy.interpolate import LinearNDInterpolator
|
39 |
from imageio import imread, imwrite
|
|
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
def write_flo(flow, filename):
|
43 |
"""
|
|
|
74 |
#frames, _, _ = read_video(str("./spacex.mp4"), output_format="TCHW")
|
75 |
#print(f"FRAME BEFORE stack: {frames[100]}")
|
76 |
|
|
|
|
|
77 |
|
78 |
input_frame_1 = read_image(str("./frame1.jpg"), ImageReadMode.UNCHANGED)
|
79 |
print(f"FRAME 1: {input_frame_1}")
|