Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,13 +26,9 @@ if torch.cuda.is_available():
|
|
| 26 |
def pix2pix(
|
| 27 |
prompt,
|
| 28 |
image,
|
| 29 |
-
text_guidance_scale,
|
| 30 |
-
image_guidance_scale,
|
| 31 |
steps,
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
height=512,
|
| 35 |
-
seed=0,
|
| 36 |
):
|
| 37 |
print(psutil.virtual_memory()) # print memory usage
|
| 38 |
|
|
@@ -48,12 +44,12 @@ def pix2pix(
|
|
| 48 |
|
| 49 |
result = pipe(
|
| 50 |
prompt,
|
| 51 |
-
negative_prompt=neg_prompt,
|
| 52 |
image=image,
|
| 53 |
num_inference_steps=int(steps),
|
| 54 |
image_guidance_scale=image_guidance_scale,
|
| 55 |
guidance_scale=text_guidance_scale,
|
| 56 |
generator=generator,
|
|
|
|
| 57 |
)
|
| 58 |
|
| 59 |
# return replace_nsfw_images(result)
|
|
@@ -125,9 +121,9 @@ def infer(prompt,video_in, seed_in, trim_value):
|
|
| 125 |
print("set stop frames to: " + str(n_frame))
|
| 126 |
|
| 127 |
for i in frames_list[0:int(n_frame)]:
|
| 128 |
-
pix2pix_img = pix2pix(prompt,i,5.5,
|
| 129 |
print(pix2pix_img)
|
| 130 |
-
image = pix2pix_img
|
| 131 |
rgb_im = image.convert("RGB")
|
| 132 |
|
| 133 |
# exporting the image
|
|
|
|
| 26 |
def pix2pix(
|
| 27 |
prompt,
|
| 28 |
image,
|
|
|
|
|
|
|
| 29 |
steps,
|
| 30 |
+
image_guidance_scale,
|
| 31 |
+
seed
|
|
|
|
|
|
|
| 32 |
):
|
| 33 |
print(psutil.virtual_memory()) # print memory usage
|
| 34 |
|
|
|
|
| 44 |
|
| 45 |
result = pipe(
|
| 46 |
prompt,
|
|
|
|
| 47 |
image=image,
|
| 48 |
num_inference_steps=int(steps),
|
| 49 |
image_guidance_scale=image_guidance_scale,
|
| 50 |
guidance_scale=text_guidance_scale,
|
| 51 |
generator=generator,
|
| 52 |
+
negative_prompt=neg_prompt,
|
| 53 |
)
|
| 54 |
|
| 55 |
# return replace_nsfw_images(result)
|
|
|
|
| 121 |
print("set stop frames to: " + str(n_frame))
|
| 122 |
|
| 123 |
for i in frames_list[0:int(n_frame)]:
|
| 124 |
+
pix2pix_img = pix2pix(prompt,i,5.5,15,seed_in)
|
| 125 |
print(pix2pix_img)
|
| 126 |
+
image = PIL.Image.open(pix2pix_img)
|
| 127 |
rgb_im = image.convert("RGB")
|
| 128 |
|
| 129 |
# exporting the image
|