Spaces:
Paused
Paused
playgound with openai dependency 4
Browse files- inference.py +2 -4
inference.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import
|
2 |
import random
|
3 |
from diffusers import DiffusionPipeline
|
4 |
import torch
|
@@ -26,12 +26,10 @@ else:
|
|
26 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", use_safetensors=True)
|
27 |
pipe = pipe.to(device)
|
28 |
|
29 |
-
MAX_SEED = np.iinfo(np.int32).max
|
30 |
-
|
31 |
def infer_stable_diffusion(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
|
32 |
|
33 |
if randomize_seed:
|
34 |
-
seed = random.randint(0, MAX_SEED)
|
35 |
|
36 |
generator = torch.Generator().manual_seed(seed)
|
37 |
|
|
|
1 |
+
import modules.constants as constants
|
2 |
import random
|
3 |
from diffusers import DiffusionPipeline
|
4 |
import torch
|
|
|
26 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", use_safetensors=True)
|
27 |
pipe = pipe.to(device)
|
28 |
|
|
|
|
|
29 |
def infer_stable_diffusion(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
|
30 |
|
31 |
if randomize_seed:
|
32 |
+
seed = random.randint(0, constants.MAX_SEED)
|
33 |
|
34 |
generator = torch.Generator().manual_seed(seed)
|
35 |
|