Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -101,6 +101,7 @@ def infer_camera_edit(
|
|
| 101 |
num_inference_steps,
|
| 102 |
height,
|
| 103 |
width,
|
|
|
|
| 104 |
):
|
| 105 |
prompt = build_camera_prompt(rotate_deg, move_forward, vertical_tilt, wideangle)
|
| 106 |
print(f"Generated Prompt: {prompt}")
|
|
@@ -166,7 +167,7 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=css) as demo:
|
|
| 166 |
is_reset = gr.State(value=False)
|
| 167 |
|
| 168 |
with gr.Tab("Camera Controls"):
|
| 169 |
-
rotate_deg = gr.Slider(label="Rotate Left–Right (°)", minimum=-90, maximum=90, step=45, value=0)
|
| 170 |
move_forward = gr.Slider(label="Move Forward → Close-Up", minimum=0, maximum=10, step=5, value=0)
|
| 171 |
vertical_tilt = gr.Slider(label="Vertical Angle (Bird ↔ Worm)", minimum=-1, maximum=1, step=1, value=0)
|
| 172 |
wideangle = gr.Checkbox(label="Wide-Angle Lens", value=False)
|
|
@@ -186,7 +187,7 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=css) as demo:
|
|
| 186 |
|
| 187 |
|
| 188 |
with gr.Column():
|
| 189 |
-
result = gr.Image(label="Output Image")
|
| 190 |
prompt_preview = gr.Textbox(label="Processed Prompt", interactive=False)
|
| 191 |
#gr.Markdown("_Each change applies a fresh camera instruction to the last output image._")
|
| 192 |
|
|
@@ -231,7 +232,7 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=css) as demo:
|
|
| 231 |
control_inputs_with_flag = [is_reset] + control_inputs
|
| 232 |
|
| 233 |
for control in [rotate_deg, move_forward, vertical_tilt, wideangle]:
|
| 234 |
-
control.change(fn=maybe_infer, inputs=control_inputs_with_flag,
|
| 235 |
|
| 236 |
run_event.then(lambda img, *_: img, inputs=[result], outputs=[prev_output])
|
| 237 |
|
|
|
|
| 101 |
num_inference_steps,
|
| 102 |
height,
|
| 103 |
width,
|
| 104 |
+
progress=gr.Progress(track_tqdm=True)
|
| 105 |
):
|
| 106 |
prompt = build_camera_prompt(rotate_deg, move_forward, vertical_tilt, wideangle)
|
| 107 |
print(f"Generated Prompt: {prompt}")
|
|
|
|
| 167 |
is_reset = gr.State(value=False)
|
| 168 |
|
| 169 |
with gr.Tab("Camera Controls"):
|
| 170 |
+
rotate_deg = gr.Slider(label="Rotate Left–Right (degrees °)", minimum=-90, maximum=90, step=45, value=0)
|
| 171 |
move_forward = gr.Slider(label="Move Forward → Close-Up", minimum=0, maximum=10, step=5, value=0)
|
| 172 |
vertical_tilt = gr.Slider(label="Vertical Angle (Bird ↔ Worm)", minimum=-1, maximum=1, step=1, value=0)
|
| 173 |
wideangle = gr.Checkbox(label="Wide-Angle Lens", value=False)
|
|
|
|
| 187 |
|
| 188 |
|
| 189 |
with gr.Column():
|
| 190 |
+
result = gr.Image(label="Output Image", interactive=False)
|
| 191 |
prompt_preview = gr.Textbox(label="Processed Prompt", interactive=False)
|
| 192 |
#gr.Markdown("_Each change applies a fresh camera instruction to the last output image._")
|
| 193 |
|
|
|
|
| 232 |
control_inputs_with_flag = [is_reset] + control_inputs
|
| 233 |
|
| 234 |
for control in [rotate_deg, move_forward, vertical_tilt, wideangle]:
|
| 235 |
+
control.change(fn=maybe_infer, inputs=control_inputs_with_flag, trigger_mode="always_last", outputs=outputs)
|
| 236 |
|
| 237 |
run_event.then(lambda img, *_: img, inputs=[result], outputs=[prev_output])
|
| 238 |
|