Veda_Sahaja commited on
Commit ·
9b40850
1
Parent(s): 304cbd6
Update space
Browse files
app.py
CHANGED
|
@@ -69,13 +69,13 @@ def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str
|
|
| 69 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 70 |
|
| 71 |
if torch.cuda.is_available():
|
| 72 |
-
torch.cuda.max_memory_allocated(device=device)
|
| 73 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
| 74 |
-
pipe.enable_xformers_memory_efficient_attention()
|
| 75 |
-
pipe = pipe.to(device)
|
| 76 |
-
else:
|
| 77 |
-
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", use_safetensors=True)
|
| 78 |
pipe = pipe.to(device)
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
MAX_SEED = np.iinfo(np.int32).max
|
| 81 |
MAX_IMAGE_SIZE = 1024
|
|
@@ -140,20 +140,22 @@ with gr.Blocks(css=css) as demo:
|
|
| 140 |
result = gr.Image(label="Result", show_label=False)
|
| 141 |
|
| 142 |
with gr.Accordion("Advanced Settings", open=False):
|
| 143 |
-
style_selection = gr.Radio(
|
| 144 |
-
show_label=True, container=True, interactive=True,
|
| 145 |
-
choices=STYLE_NAMES,
|
| 146 |
-
value=DEFAULT_STYLE_NAME,
|
| 147 |
-
label='Image Style'
|
| 148 |
-
)
|
| 149 |
negative_prompt = gr.Textbox(
|
| 150 |
-
label="
|
| 151 |
show_label=False,
|
| 152 |
max_lines=1,
|
| 153 |
placeholder="Enter a negative prompt",
|
| 154 |
elem_id="negative-prompt-text-input",
|
|
|
|
| 155 |
)
|
| 156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
seed = gr.Slider(
|
| 158 |
label="Seed",
|
| 159 |
minimum=0,
|
|
|
|
| 69 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 70 |
|
| 71 |
if torch.cuda.is_available():
|
| 72 |
+
# torch.cuda.max_memory_allocated(device=device)
|
| 73 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
| 74 |
+
# pipe.enable_xformers_memory_efficient_attention()
|
|
|
|
|
|
|
|
|
|
| 75 |
pipe = pipe.to(device)
|
| 76 |
+
# else:
|
| 77 |
+
# pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", use_safetensors=True)
|
| 78 |
+
# pipe = pipe.to(device)
|
| 79 |
|
| 80 |
MAX_SEED = np.iinfo(np.int32).max
|
| 81 |
MAX_IMAGE_SIZE = 1024
|
|
|
|
| 140 |
result = gr.Image(label="Result", show_label=False)
|
| 141 |
|
| 142 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
negative_prompt = gr.Textbox(
|
| 144 |
+
label="Negative prompt",
|
| 145 |
show_label=False,
|
| 146 |
max_lines=1,
|
| 147 |
placeholder="Enter a negative prompt",
|
| 148 |
elem_id="negative-prompt-text-input",
|
| 149 |
+
value="low-quality, text, blurry, fuzziness"
|
| 150 |
)
|
| 151 |
|
| 152 |
+
style_selection = gr.Radio(
|
| 153 |
+
show_label=True, container=True, interactive=True,
|
| 154 |
+
choices=STYLE_NAMES,
|
| 155 |
+
value=DEFAULT_STYLE_NAME,
|
| 156 |
+
label='Image Style'
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
seed = gr.Slider(
|
| 160 |
label="Seed",
|
| 161 |
minimum=0,
|