Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,26 +35,17 @@ def infer(prompt):
|
|
| 35 |
#generator = torch.Generator(device=device).manual_seed(seed)
|
| 36 |
#print("Is GPU busy? ", is_gpu_busy)
|
| 37 |
images = []
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
# if(images_list["nsfw_content_detected"][i]):
|
| 50 |
-
# images.append(safe_image)
|
| 51 |
-
# else:
|
| 52 |
-
# images.append(image)
|
| 53 |
-
#else:
|
| 54 |
-
with autocast("cuda"):
|
| 55 |
-
generated = pipe(prompt, guidance_scale=7.5)["sample"]
|
| 56 |
-
|
| 57 |
-
return generated
|
| 58 |
|
| 59 |
|
| 60 |
css = """
|
|
|
|
| 35 |
#generator = torch.Generator(device=device).manual_seed(seed)
|
| 36 |
#print("Is GPU busy? ", is_gpu_busy)
|
| 37 |
images = []
|
| 38 |
+
if(not is_gpu_busy):
|
| 39 |
+
is_gpu_busy = True
|
| 40 |
+
with autocast("cuda"):
|
| 41 |
+
images = pipe(
|
| 42 |
+
[prompt] * samples,
|
| 43 |
+
num_inference_steps=steps,
|
| 44 |
+
guidance_scale=scale,
|
| 45 |
+
#generator=generator,
|
| 46 |
+
).images
|
| 47 |
+
|
| 48 |
+
return images
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
css = """
|