Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ if not torch.cuda.is_available():
|
|
27 |
|
28 |
MAX_SEED = np.iinfo(np.int32).max
|
29 |
CACHE_EXAMPLES = torch.cuda.is_available() and os.getenv("CACHE_EXAMPLES") == "1"
|
30 |
-
MAX_IMAGE_SIZE = int(os.getenv("MAX_IMAGE_SIZE", "
|
31 |
USE_TORCH_COMPILE = os.getenv("USE_TORCH_COMPILE") == "1"
|
32 |
DTYPE = torch.float32 # torch.float16 works as well, but pictures seem to be a bit worse
|
33 |
|
@@ -89,6 +89,9 @@ def generate(
|
|
89 |
) -> PIL.Image.Image:
|
90 |
torch.manual_seed(seed)
|
91 |
|
|
|
|
|
|
|
92 |
return pipe(
|
93 |
prompt=prompt,
|
94 |
width=width,
|
|
|
27 |
|
28 |
MAX_SEED = np.iinfo(np.int32).max
|
29 |
CACHE_EXAMPLES = torch.cuda.is_available() and os.getenv("CACHE_EXAMPLES") == "1"
|
30 |
+
MAX_IMAGE_SIZE = int(os.getenv("MAX_IMAGE_SIZE", "768"))
|
31 |
USE_TORCH_COMPILE = os.getenv("USE_TORCH_COMPILE") == "1"
|
32 |
DTYPE = torch.float32 # torch.float16 works as well, but pictures seem to be a bit worse
|
33 |
|
|
|
89 |
) -> PIL.Image.Image:
|
90 |
torch.manual_seed(seed)
|
91 |
|
92 |
+
if width > 512 or height > 512:
|
93 |
+
num_images = 2
|
94 |
+
|
95 |
return pipe(
|
96 |
prompt=prompt,
|
97 |
width=width,
|