Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -321,7 +321,7 @@ def _generate_image(prompt_embeds, image_list, width, height, num_inference_step
|
|
| 321 |
}
|
| 322 |
return None, error_info
|
| 323 |
|
| 324 |
-
def infer(prompt, input_images=None, seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=50, guidance_scale=2.5,
|
| 325 |
|
| 326 |
if randomize_seed:
|
| 327 |
seed = random.randint(0, MAX_SEED)
|
|
@@ -338,13 +338,6 @@ def infer(prompt, input_images=None, seed=42, randomize_seed=False, width=1024,
|
|
| 338 |
|
| 339 |
# 1. Upsampling (Network bound - No GPU needed)
|
| 340 |
final_prompt = prompt
|
| 341 |
-
# 强制不优化提示词
|
| 342 |
-
# if prompt_upsampling:
|
| 343 |
-
# progress(0.05, desc="Upsampling prompt...")
|
| 344 |
-
# final_prompt = upsample_prompt_logic(prompt, image_list)
|
| 345 |
-
# print(f"Original Prompt: {prompt}")
|
| 346 |
-
# print(f"Upsampled Prompt: {final_prompt}")
|
| 347 |
-
|
| 348 |
# 2. Text Encoding (Network bound - No GPU needed)
|
| 349 |
progress(0.1, desc="Encoding prompt...")
|
| 350 |
# This returns CPU tensors
|
|
@@ -422,11 +415,6 @@ with gr.Blocks() as demo:
|
|
| 422 |
)
|
| 423 |
|
| 424 |
with gr.Accordion("Advanced Settings", open=False):
|
| 425 |
-
prompt_upsampling = gr.Checkbox(
|
| 426 |
-
label="Prompt Upsampling",
|
| 427 |
-
value=False,
|
| 428 |
-
info="Automatically enhance the prompt using a VLM"
|
| 429 |
-
)
|
| 430 |
|
| 431 |
seed = gr.Slider(
|
| 432 |
label="Seed",
|
|
@@ -500,7 +488,7 @@ with gr.Blocks() as demo:
|
|
| 500 |
gr.on(
|
| 501 |
triggers=[run_button.click, prompt.submit],
|
| 502 |
fn=infer,
|
| 503 |
-
inputs=[prompt, input_images, seed, randomize_seed, width, height, num_inference_steps, guidance_scale
|
| 504 |
outputs=[result, seed]
|
| 505 |
)
|
| 506 |
|
|
|
|
| 321 |
}
|
| 322 |
return None, error_info
|
| 323 |
|
| 324 |
+
def infer(prompt, input_images=None, seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=50, guidance_scale=2.5, progress=gr.Progress()):
|
| 325 |
|
| 326 |
if randomize_seed:
|
| 327 |
seed = random.randint(0, MAX_SEED)
|
|
|
|
| 338 |
|
| 339 |
# 1. Upsampling (Network bound - No GPU needed)
|
| 340 |
final_prompt = prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
# 2. Text Encoding (Network bound - No GPU needed)
|
| 342 |
progress(0.1, desc="Encoding prompt...")
|
| 343 |
# This returns CPU tensors
|
|
|
|
| 415 |
)
|
| 416 |
|
| 417 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
|
| 419 |
seed = gr.Slider(
|
| 420 |
label="Seed",
|
|
|
|
| 488 |
gr.on(
|
| 489 |
triggers=[run_button.click, prompt.submit],
|
| 490 |
fn=infer,
|
| 491 |
+
inputs=[prompt, input_images, seed, randomize_seed, width, height, num_inference_steps, guidance_scale],
|
| 492 |
outputs=[result, seed]
|
| 493 |
)
|
| 494 |
|