Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,17 +6,8 @@ import random
|
|
| 6 |
from diffusers import DiffusionPipeline
|
| 7 |
import torch
|
| 8 |
|
| 9 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 10 |
model_repo_id = "stabilityai/sdxl-turbo" # Replace to the model you would like to use
|
| 11 |
|
| 12 |
-
if torch.cuda.is_available():
|
| 13 |
-
torch_dtype = torch.float16
|
| 14 |
-
else:
|
| 15 |
-
torch_dtype = torch.float32
|
| 16 |
-
|
| 17 |
-
pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
| 18 |
-
pipe = pipe.to(device)
|
| 19 |
-
|
| 20 |
MAX_SEED = np.iinfo(np.int32).max
|
| 21 |
MAX_IMAGE_SIZE = 1024
|
| 22 |
|
|
@@ -61,13 +52,6 @@ def infer(
|
|
| 61 |
|
| 62 |
return image, seed
|
| 63 |
|
| 64 |
-
|
| 65 |
-
examples = [
|
| 66 |
-
"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
|
| 67 |
-
"An astronaut riding a green horse",
|
| 68 |
-
"A delicious ceviche cheesecake slice",
|
| 69 |
-
]
|
| 70 |
-
|
| 71 |
css = """
|
| 72 |
#col-container {
|
| 73 |
margin: 0 auto;
|
|
@@ -155,7 +139,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 155 |
value=20, # Replace with defaults that work for your model
|
| 156 |
)
|
| 157 |
|
| 158 |
-
gr.Examples(examples=examples, inputs=[prompt])
|
| 159 |
gr.on(
|
| 160 |
triggers=[run_button.click, prompt.submit],
|
| 161 |
fn=infer,
|
|
|
|
| 6 |
from diffusers import DiffusionPipeline
|
| 7 |
import torch
|
| 8 |
|
|
|
|
| 9 |
model_repo_id = "stabilityai/sdxl-turbo" # Replace to the model you would like to use
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
MAX_SEED = np.iinfo(np.int32).max
|
| 12 |
MAX_IMAGE_SIZE = 1024
|
| 13 |
|
|
|
|
| 52 |
|
| 53 |
return image, seed
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
css = """
|
| 56 |
#col-container {
|
| 57 |
margin: 0 auto;
|
|
|
|
| 139 |
value=20, # Replace with defaults that work for your model
|
| 140 |
)
|
| 141 |
|
|
|
|
| 142 |
gr.on(
|
| 143 |
triggers=[run_button.click, prompt.submit],
|
| 144 |
fn=infer,
|