Spaces:
Running
on
Zero
Running
on
Zero
alfredplpl
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -3,8 +3,9 @@ import numpy as np
|
|
3 |
import random
|
4 |
from diffusers import DiffusionPipeline
|
5 |
import torch
|
|
|
6 |
|
7 |
-
device = "cuda"
|
8 |
|
9 |
if torch.cuda.is_available():
|
10 |
torch.cuda.max_memory_allocated(device=device)
|
@@ -50,10 +51,7 @@ css="""
|
|
50 |
}
|
51 |
"""
|
52 |
|
53 |
-
|
54 |
-
power_device = "GPU"
|
55 |
-
else:
|
56 |
-
power_device = "CPU"
|
57 |
|
58 |
with gr.Blocks(css=css) as demo:
|
59 |
|
@@ -65,27 +63,12 @@ with gr.Blocks(css=css) as demo:
|
|
65 |
|
66 |
with gr.Row():
|
67 |
|
68 |
-
prompt = gr.Text(
|
69 |
-
label="Prompt",
|
70 |
-
show_label=False,
|
71 |
-
max_lines=1,
|
72 |
-
placeholder="Enter your prompt",
|
73 |
-
container=False,
|
74 |
-
)
|
75 |
-
|
76 |
run_button = gr.Button("Run", scale=0)
|
77 |
|
78 |
result = gr.Image(label="Result", show_label=False)
|
79 |
|
80 |
with gr.Accordion("Advanced Settings", open=False):
|
81 |
|
82 |
-
negative_prompt = gr.Text(
|
83 |
-
label="Negative prompt",
|
84 |
-
max_lines=1,
|
85 |
-
placeholder="Enter a negative prompt",
|
86 |
-
visible=False,
|
87 |
-
)
|
88 |
-
|
89 |
seed = gr.Slider(
|
90 |
label="Seed",
|
91 |
minimum=0,
|
@@ -139,7 +122,7 @@ with gr.Blocks(css=css) as demo:
|
|
139 |
|
140 |
run_button.click(
|
141 |
fn = infer,
|
142 |
-
inputs = [
|
143 |
outputs = [result]
|
144 |
)
|
145 |
|
|
|
3 |
import random
|
4 |
from diffusers import DiffusionPipeline
|
5 |
import torch
|
6 |
+
import spaces
|
7 |
|
8 |
+
device = "cuda"
|
9 |
|
10 |
if torch.cuda.is_available():
|
11 |
torch.cuda.max_memory_allocated(device=device)
|
|
|
51 |
}
|
52 |
"""
|
53 |
|
54 |
+
power_device = "GPU"
|
|
|
|
|
|
|
55 |
|
56 |
with gr.Blocks(css=css) as demo:
|
57 |
|
|
|
63 |
|
64 |
with gr.Row():
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
run_button = gr.Button("Run", scale=0)
|
67 |
|
68 |
result = gr.Image(label="Result", show_label=False)
|
69 |
|
70 |
with gr.Accordion("Advanced Settings", open=False):
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
seed = gr.Slider(
|
73 |
label="Seed",
|
74 |
minimum=0,
|
|
|
122 |
|
123 |
run_button.click(
|
124 |
fn = infer,
|
125 |
+
inputs = [seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
126 |
outputs = [result]
|
127 |
)
|
128 |
|