Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,9 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
8 |
|
9 |
if torch.cuda.is_available():
|
10 |
torch.cuda.max_memory_allocated(device=device)
|
11 |
-
#torch.cuda.empty_cache()
|
12 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
13 |
pipe.enable_xformers_memory_efficient_attention()
|
14 |
pipe = pipe.to(device)
|
15 |
-
#torch.cuda.empty_cache()
|
16 |
else:
|
17 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", use_safetensors=True)
|
18 |
pipe = pipe.to(device)
|
@@ -52,11 +50,17 @@ css="""
|
|
52 |
}
|
53 |
"""
|
54 |
|
|
|
|
|
|
|
|
|
|
|
55 |
with gr.Blocks(css=css) as demo:
|
56 |
|
57 |
with gr.Column(elem_id="col-container"):
|
58 |
-
gr.Markdown("""
|
59 |
# Text-to-Image Gradio Template
|
|
|
60 |
""")
|
61 |
|
62 |
with gr.Row():
|
@@ -99,7 +103,7 @@ with gr.Blocks(css=css) as demo:
|
|
99 |
minimum=256,
|
100 |
maximum=MAX_IMAGE_SIZE,
|
101 |
step=32,
|
102 |
-
value=
|
103 |
)
|
104 |
|
105 |
height = gr.Slider(
|
@@ -107,17 +111,17 @@ with gr.Blocks(css=css) as demo:
|
|
107 |
minimum=256,
|
108 |
maximum=MAX_IMAGE_SIZE,
|
109 |
step=32,
|
110 |
-
value=
|
111 |
)
|
112 |
|
113 |
with gr.Row():
|
114 |
|
115 |
guidance_scale = gr.Slider(
|
116 |
label="Guidance scale",
|
117 |
-
minimum=
|
118 |
-
maximum=
|
119 |
step=0.1,
|
120 |
-
value=
|
121 |
)
|
122 |
|
123 |
num_inference_steps = gr.Slider(
|
|
|
8 |
|
9 |
if torch.cuda.is_available():
|
10 |
torch.cuda.max_memory_allocated(device=device)
|
|
|
11 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
12 |
pipe.enable_xformers_memory_efficient_attention()
|
13 |
pipe = pipe.to(device)
|
|
|
14 |
else:
|
15 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", use_safetensors=True)
|
16 |
pipe = pipe.to(device)
|
|
|
50 |
}
|
51 |
"""
|
52 |
|
53 |
+
if torch.cuda.is_available():
|
54 |
+
power_device = "GPU"
|
55 |
+
else:
|
56 |
+
power_device = "CPU"
|
57 |
+
|
58 |
with gr.Blocks(css=css) as demo:
|
59 |
|
60 |
with gr.Column(elem_id="col-container"):
|
61 |
+
gr.Markdown(f"""
|
62 |
# Text-to-Image Gradio Template
|
63 |
+
Currently running on {power_device}.
|
64 |
""")
|
65 |
|
66 |
with gr.Row():
|
|
|
103 |
minimum=256,
|
104 |
maximum=MAX_IMAGE_SIZE,
|
105 |
step=32,
|
106 |
+
value=512,
|
107 |
)
|
108 |
|
109 |
height = gr.Slider(
|
|
|
111 |
minimum=256,
|
112 |
maximum=MAX_IMAGE_SIZE,
|
113 |
step=32,
|
114 |
+
value=512,
|
115 |
)
|
116 |
|
117 |
with gr.Row():
|
118 |
|
119 |
guidance_scale = gr.Slider(
|
120 |
label="Guidance scale",
|
121 |
+
minimum=0.0,
|
122 |
+
maximum=10.0,
|
123 |
step=0.1,
|
124 |
+
value=0.0,
|
125 |
)
|
126 |
|
127 |
num_inference_steps = gr.Slider(
|