Spaces:
Runtime error
Runtime error
Update app.py
#1
by
NNEngine
- opened
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import spaces
|
|
| 5 |
import torch
|
| 6 |
from diffusers import DiffusionPipeline
|
| 7 |
|
| 8 |
-
dtype = torch.bfloat16
|
| 9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 10 |
|
| 11 |
pipe = DiffusionPipeline.from_pretrained("shuttleai/shuttle-jaguar", torch_dtype=dtype).to(device)
|
|
@@ -20,14 +20,14 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_in
|
|
| 20 |
"""
|
| 21 |
if randomize_seed:
|
| 22 |
seed = random.randint(0, MAX_SEED)
|
| 23 |
-
generator = torch.Generator().manual_seed(seed)
|
| 24 |
image = pipe(
|
| 25 |
prompt = prompt,
|
| 26 |
width = width,
|
| 27 |
height = height,
|
| 28 |
num_inference_steps = num_inference_steps,
|
| 29 |
generator = generator,
|
| 30 |
-
guidance_scale=
|
| 31 |
).images[0]
|
| 32 |
return image, seed
|
| 33 |
|
|
@@ -72,7 +72,7 @@ Shuttle Jaguar is a text-to-image AI model designed to generate highly aesthetic
|
|
| 72 |
minimum=0,
|
| 73 |
maximum=MAX_SEED,
|
| 74 |
step=1,
|
| 75 |
-
value=
|
| 76 |
)
|
| 77 |
|
| 78 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
|
@@ -94,6 +94,9 @@ Shuttle Jaguar is a text-to-image AI model designed to generate highly aesthetic
|
|
| 94 |
step=32,
|
| 95 |
value=1024,
|
| 96 |
)
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
with gr.Row():
|
| 99 |
|
|
|
|
| 5 |
import torch
|
| 6 |
from diffusers import DiffusionPipeline
|
| 7 |
|
| 8 |
+
dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
|
| 9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 10 |
|
| 11 |
pipe = DiffusionPipeline.from_pretrained("shuttleai/shuttle-jaguar", torch_dtype=dtype).to(device)
|
|
|
|
| 20 |
"""
|
| 21 |
if randomize_seed:
|
| 22 |
seed = random.randint(0, MAX_SEED)
|
| 23 |
+
generator = torch.Generator(device=device).manual_seed(seed)
|
| 24 |
image = pipe(
|
| 25 |
prompt = prompt,
|
| 26 |
width = width,
|
| 27 |
height = height,
|
| 28 |
num_inference_steps = num_inference_steps,
|
| 29 |
generator = generator,
|
| 30 |
+
guidance_scale=2.0
|
| 31 |
).images[0]
|
| 32 |
return image, seed
|
| 33 |
|
|
|
|
| 72 |
minimum=0,
|
| 73 |
maximum=MAX_SEED,
|
| 74 |
step=1,
|
| 75 |
+
value=42,
|
| 76 |
)
|
| 77 |
|
| 78 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
|
|
|
| 94 |
step=32,
|
| 95 |
value=1024,
|
| 96 |
)
|
| 97 |
+
|
| 98 |
+
width = min(width, MAX_IMAGE_SIZE)
|
| 99 |
+
height = min(height, MAX_IMAGE_SIZE)
|
| 100 |
|
| 101 |
with gr.Row():
|
| 102 |
|