Spaces:
Runtime error
Runtime error
cocktailpeanut
commited on
Commit
•
bd7e1ce
1
Parent(s):
be0bcaf
update
Browse files
app.py
CHANGED
@@ -3,9 +3,11 @@ import numpy as np
|
|
3 |
import random
|
4 |
import torch
|
5 |
from diffusers import StableDiffusion3Pipeline, SD3Transformer2DModel, FlowMatchEulerDiscreteScheduler
|
6 |
-
import
|
|
|
7 |
|
8 |
-
device =
|
|
|
9 |
dtype = torch.float16
|
10 |
|
11 |
repo = "stabilityai/stable-diffusion-3-medium"
|
@@ -15,7 +17,7 @@ pipe = StableDiffusion3Pipeline.from_pretrained(repo, torch_dtype=torch.float16,
|
|
15 |
MAX_SEED = np.iinfo(np.int32).max
|
16 |
MAX_IMAGE_SIZE = 1344
|
17 |
|
18 |
-
|
19 |
def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps, progress=gr.Progress(track_tqdm=True)):
|
20 |
|
21 |
if randomize_seed:
|
@@ -135,4 +137,4 @@ with gr.Blocks(css=css) as demo:
|
|
135 |
outputs = [result, seed]
|
136 |
)
|
137 |
|
138 |
-
demo.launch()
|
|
|
3 |
import random
|
4 |
import torch
|
5 |
from diffusers import StableDiffusion3Pipeline, SD3Transformer2DModel, FlowMatchEulerDiscreteScheduler
|
6 |
+
import devicetorch
|
7 |
+
#import spaces
|
8 |
|
9 |
+
device = devicetorch.get(torch)
|
10 |
+
#device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
dtype = torch.float16
|
12 |
|
13 |
repo = "stabilityai/stable-diffusion-3-medium"
|
|
|
17 |
MAX_SEED = np.iinfo(np.int32).max
|
18 |
MAX_IMAGE_SIZE = 1344
|
19 |
|
20 |
+
#@spaces.GPU
|
21 |
def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps, progress=gr.Progress(track_tqdm=True)):
|
22 |
|
23 |
if randomize_seed:
|
|
|
137 |
outputs = [result, seed]
|
138 |
)
|
139 |
|
140 |
+
demo.launch()
|