Spaces:
Running
on
Zero
Running
on
Zero
lixiang46
commited on
Commit
•
d4fa96f
1
Parent(s):
91eb14f
update
Browse files
app.py
CHANGED
@@ -54,7 +54,17 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
54 |
MAX_IMAGE_SIZE = 2048
|
55 |
|
56 |
@spaces.GPU
|
57 |
-
def infer(prompt,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
if randomize_seed:
|
59 |
seed = random.randint(0, MAX_SEED)
|
60 |
generator = torch.Generator().manual_seed(seed)
|
@@ -180,13 +190,15 @@ with gr.Blocks(css=css) as demo:
|
|
180 |
|
181 |
with gr.Row():
|
182 |
gr.Examples(
|
|
|
183 |
examples = examples,
|
184 |
-
inputs = [prompt, ip_adapter_image, ip_adapter_scale]
|
|
|
185 |
)
|
186 |
|
187 |
run_button.click(
|
188 |
fn = infer,
|
189 |
-
inputs = [prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps
|
190 |
outputs = [result]
|
191 |
)
|
192 |
|
|
|
54 |
MAX_IMAGE_SIZE = 2048
|
55 |
|
56 |
@spaces.GPU
|
57 |
+
def infer(prompt,
|
58 |
+
ip_adapter_image = None,
|
59 |
+
ip_adapter_scale = 0.5,
|
60 |
+
negative_prompt = "",
|
61 |
+
seed = 0,
|
62 |
+
randomize_seed = True,
|
63 |
+
width = 1024,
|
64 |
+
height = 1024,
|
65 |
+
guidance_scale = 5.0,
|
66 |
+
num_inference_steps = 25
|
67 |
+
):
|
68 |
if randomize_seed:
|
69 |
seed = random.randint(0, MAX_SEED)
|
70 |
generator = torch.Generator().manual_seed(seed)
|
|
|
190 |
|
191 |
with gr.Row():
|
192 |
gr.Examples(
|
193 |
+
fn = infer,
|
194 |
examples = examples,
|
195 |
+
inputs = [prompt, ip_adapter_image, ip_adapter_scale],
|
196 |
+
outputs = [result]
|
197 |
)
|
198 |
|
199 |
run_button.click(
|
200 |
fn = infer,
|
201 |
+
inputs = [prompt, ip_adapter_image, ip_adapter_scale, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
202 |
outputs = [result]
|
203 |
)
|
204 |
|