Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -148,9 +148,10 @@ def infer(input_image, prompt, illumination_dropdown, direction_dropdown, seed=4
|
|
148 |
progress (gr.Progress): A Gradio progress tracker for the UI.
|
149 |
|
150 |
Returns:
|
151 |
-
tuple[PIL.Image.Image, int]: A tuple containing:
|
152 |
- The relighted output image.
|
153 |
- The seed used for the generation.
|
|
|
154 |
|
155 |
------------------------------------------------------------------------------------
|
156 |
Dropdown Options
|
@@ -294,7 +295,7 @@ def infer(input_image, prompt, illumination_dropdown, direction_dropdown, seed=4
|
|
294 |
height=input_image.size[1],
|
295 |
generator=torch.Generator().manual_seed(seed),
|
296 |
).images[0]
|
297 |
-
return image, seed
|
298 |
|
299 |
def update_prompt_from_dropdown(illumination_option):
|
300 |
"""Update the prompt textbox based on dropdown selection"""
|
@@ -372,7 +373,7 @@ with gr.Blocks(css=css) as demo:
|
|
372 |
|
373 |
with gr.Column():
|
374 |
result = gr.Image(label="Result", show_label=False, interactive=False)
|
375 |
-
|
376 |
# update prompt when dropdown changes
|
377 |
illumination_dropdown.change(
|
378 |
fn=update_prompt_from_dropdown,
|
@@ -402,7 +403,7 @@ with gr.Blocks(css=css) as demo:
|
|
402 |
triggers=[run_button.click, prompt.submit],
|
403 |
fn = infer,
|
404 |
inputs = [input_image, prompt, illumination_dropdown, direction_dropdown, seed, randomize_seed, guidance_scale],
|
405 |
-
outputs = [result, seed]
|
406 |
)
|
407 |
|
408 |
|
|
|
148 |
progress (gr.Progress): A Gradio progress tracker for the UI.
|
149 |
|
150 |
Returns:
|
151 |
+
tuple[PIL.Image.Image, int, str]: A tuple containing:
|
152 |
- The relighted output image.
|
153 |
- The seed used for the generation.
|
154 |
+
- The final constructed prompt string used by the model.
|
155 |
|
156 |
------------------------------------------------------------------------------------
|
157 |
Dropdown Options
|
|
|
295 |
height=input_image.size[1],
|
296 |
generator=torch.Generator().manual_seed(seed),
|
297 |
).images[0]
|
298 |
+
return image, seed, prompt_with_template
|
299 |
|
300 |
def update_prompt_from_dropdown(illumination_option):
|
301 |
"""Update the prompt textbox based on dropdown selection"""
|
|
|
373 |
|
374 |
with gr.Column():
|
375 |
result = gr.Image(label="Result", show_label=False, interactive=False)
|
376 |
+
final_prompt = gr.Textbox(label="Processed prompt")
|
377 |
# update prompt when dropdown changes
|
378 |
illumination_dropdown.change(
|
379 |
fn=update_prompt_from_dropdown,
|
|
|
403 |
triggers=[run_button.click, prompt.submit],
|
404 |
fn = infer,
|
405 |
inputs = [input_image, prompt, illumination_dropdown, direction_dropdown, seed, randomize_seed, guidance_scale],
|
406 |
+
outputs = [result, seed, final_prompt]
|
407 |
)
|
408 |
|
409 |
|