Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,8 @@ 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
|
|
@@ -21,17 +22,17 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
| 21 |
MAX_IMAGE_SIZE = 1024
|
| 22 |
|
| 23 |
|
| 24 |
-
|
| 25 |
def infer(
|
| 26 |
-
model_id: Optional[str] = "CompVis/stable-diffusion-v1-4",
|
| 27 |
negative_prompt=gr.Text('cat, dog'),
|
| 28 |
-
prompt: str,
|
| 29 |
-
seed,
|
| 30 |
randomize_seed,
|
| 31 |
-
width,
|
| 32 |
-
height,
|
| 33 |
-
guidance_scale,
|
| 34 |
-
num_inference_steps,
|
| 35 |
progress=gr.Progress(track_tqdm=True),
|
| 36 |
):
|
| 37 |
if randomize_seed:
|
|
|
|
| 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 |
+
model_repo_id = "CompVis/stable-diffusion-v1-4"
|
| 12 |
|
| 13 |
if torch.cuda.is_available():
|
| 14 |
torch_dtype = torch.float16
|
|
|
|
| 22 |
MAX_IMAGE_SIZE = 1024
|
| 23 |
|
| 24 |
|
| 25 |
+
@spaces.GPU #[uncomment to use ZeroGPU]
|
| 26 |
def infer(
|
| 27 |
+
# model_id: Optional[str] = "CompVis/stable-diffusion-v1-4",
|
| 28 |
negative_prompt=gr.Text('cat, dog'),
|
| 29 |
+
prompt: str = 'cute_animal',
|
| 30 |
+
seed: Optional[int] = 42,
|
| 31 |
randomize_seed,
|
| 32 |
+
width = 128,
|
| 33 |
+
height = 128,
|
| 34 |
+
guidance_scale: Optional[float] = 7,
|
| 35 |
+
num_inference_steps: Optional[int] = 20,
|
| 36 |
progress=gr.Progress(track_tqdm=True),
|
| 37 |
):
|
| 38 |
if randomize_seed:
|