Update app.py
Browse filesAdd gc to do tensor cleanup
app.py
CHANGED
@@ -6,10 +6,11 @@ from flax.jax_utils import replicate
|
|
6 |
from flax.training.common_utils import shard
|
7 |
from PIL import Image
|
8 |
from diffusers import FlaxStableDiffusionControlNetPipeline, FlaxControlNetModel
|
9 |
-
import cv2
|
|
|
10 |
|
11 |
-
with open("test.html") as f:
|
12 |
-
|
13 |
|
14 |
def create_key(seed=0):
|
15 |
return jax.random.PRNGKey(seed)
|
@@ -63,6 +64,9 @@ def infer(prompts, negative_prompts, image):
|
|
63 |
).images[0]
|
64 |
|
65 |
#output_images = pipe.numpy_to_pil(np.asarray(output.reshape((num_samples,) + output.shape[-3:])))
|
|
|
|
|
|
|
66 |
return output
|
67 |
|
68 |
with gr.Blocks(theme='kfahn/AnimalPose') as demo:
|
|
|
6 |
from flax.training.common_utils import shard
|
7 |
from PIL import Image
|
8 |
from diffusers import FlaxStableDiffusionControlNetPipeline, FlaxControlNetModel
|
9 |
+
#import cv2
|
10 |
+
import gc
|
11 |
|
12 |
+
#with open("test.html") as f:
|
13 |
+
# lines = f.readlines()
|
14 |
|
15 |
def create_key(seed=0):
|
16 |
return jax.random.PRNGKey(seed)
|
|
|
64 |
).images[0]
|
65 |
|
66 |
#output_images = pipe.numpy_to_pil(np.asarray(output.reshape((num_samples,) + output.shape[-3:])))
|
67 |
+
del image
|
68 |
+
gc.collect()
|
69 |
+
|
70 |
return output
|
71 |
|
72 |
with gr.Blocks(theme='kfahn/AnimalPose') as demo:
|