Spaces:
Runtime error
Runtime error
6Morpheus6
commited on
Commit
•
0deab39
1
Parent(s):
a06e683
GRADIO_TEMP_DIR fix
Browse filesfixes error if GRADIO_TEMP_DIR is not set
app.py
CHANGED
@@ -7,6 +7,7 @@ import gc
|
|
7 |
import cv2
|
8 |
import torch
|
9 |
import random
|
|
|
10 |
import numpy as np
|
11 |
from PIL import Image
|
12 |
from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline
|
@@ -163,7 +164,7 @@ def create_image(image_pil,
|
|
163 |
target="Load only style blocks",
|
164 |
neg_content_prompt=None,
|
165 |
neg_content_scale=0,
|
166 |
-
progress=gr.Progress(track_tqdm=True)
|
167 |
):
|
168 |
|
169 |
if target =="Load original IP-Adapter":
|
@@ -215,7 +216,7 @@ def create_image(image_pil,
|
|
215 |
controlnet_conditioning_scale=float(control_scale),
|
216 |
)
|
217 |
|
218 |
-
gradio_temp_dir = os.environ
|
219 |
temp_file_path = os.path.join(gradio_temp_dir, "image.png")
|
220 |
images[0].save(temp_file_path, format="PNG")
|
221 |
print(f"Image saved in: {temp_file_path}")
|
|
|
7 |
import cv2
|
8 |
import torch
|
9 |
import random
|
10 |
+
import tempfile
|
11 |
import numpy as np
|
12 |
from PIL import Image
|
13 |
from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline
|
|
|
164 |
target="Load only style blocks",
|
165 |
neg_content_prompt=None,
|
166 |
neg_content_scale=0,
|
167 |
+
# progress=gr.Progress(track_tqdm=True)
|
168 |
):
|
169 |
|
170 |
if target =="Load original IP-Adapter":
|
|
|
216 |
controlnet_conditioning_scale=float(control_scale),
|
217 |
)
|
218 |
|
219 |
+
gradio_temp_dir = os.environ.get('GRADIO_TEMP_DIR', tempfile.gettempdir())
|
220 |
temp_file_path = os.path.join(gradio_temp_dir, "image.png")
|
221 |
images[0].save(temp_file_path, format="PNG")
|
222 |
print(f"Image saved in: {temp_file_path}")
|