Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -149,7 +149,7 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
149 |
if randomize_seed:
|
150 |
seed = random.randint(0, MAX_SEED)
|
151 |
return seed
|
152 |
-
|
153 |
@spaces.GPU(duration=60)
|
154 |
def generate(
|
155 |
model_choice: str,
|
@@ -189,7 +189,8 @@ def generate(
|
|
189 |
options["use_resolution_binning"] = True
|
190 |
|
191 |
images = []
|
192 |
-
|
|
|
193 |
batch_options = options.copy()
|
194 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
195 |
if "negative_prompt" in batch_options:
|
|
|
149 |
if randomize_seed:
|
150 |
seed = random.randint(0, MAX_SEED)
|
151 |
return seed
|
152 |
+
|
153 |
@spaces.GPU(duration=60)
|
154 |
def generate(
|
155 |
model_choice: str,
|
|
|
189 |
options["use_resolution_binning"] = True
|
190 |
|
191 |
images = []
|
192 |
+
with torch.no_grad():
|
193 |
+
for i in range(0, num_images, BATCH_SIZE):
|
194 |
batch_options = options.copy()
|
195 |
batch_options["prompt"] = options["prompt"][i:i+BATCH_SIZE]
|
196 |
if "negative_prompt" in batch_options:
|