Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -512,19 +512,32 @@ def main_ui():
|
|
| 512 |
outputs=preview_output
|
| 513 |
)
|
| 514 |
|
| 515 |
-
|
| 516 |
-
#
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
|
|
|
|
|
|
|
|
|
| 522 |
return 100, 100
|
| 523 |
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 527 |
)
|
|
|
|
| 528 |
|
| 529 |
transform_btn.click(
|
| 530 |
fn=img_to_image,
|
|
|
|
| 512 |
outputs=preview_output
|
| 513 |
)
|
| 514 |
|
| 515 |
+
|
| 516 |
+
# ALTERNATIVE CLICK-ERKENNUNG
|
| 517 |
+
click_x = gr.Number(value=100, visible=False)
|
| 518 |
+
click_y = gr.Number(value=100, visible=False)
|
| 519 |
+
|
| 520 |
+
def capture_click(image, event):
|
| 521 |
+
if event:
|
| 522 |
+
print(f"🎯 CLICK ERFOLGREICH: ({event.x}, {event.y})")
|
| 523 |
+
return event.x, event.y
|
| 524 |
+
print("❌ CLICK FEHLGESCHLAGEN")
|
| 525 |
return 100, 100
|
| 526 |
|
| 527 |
+
# Verwende .click() statt .select()
|
| 528 |
+
preview_output.click(
|
| 529 |
+
fn=capture_click,
|
| 530 |
+
inputs=[preview_output],
|
| 531 |
+
outputs=[click_x, click_y]
|
| 532 |
+
)
|
| 533 |
+
|
| 534 |
+
# Ändere die Text-Integration auf click_x, click_y
|
| 535 |
+
text_btn_i2i.click(
|
| 536 |
+
fn=handle_text_integration_i2i,
|
| 537 |
+
inputs=[img_input, img_output, text_input_i2i, click_x, click_y, target_selector],
|
| 538 |
+
outputs=[img_input, img_output]
|
| 539 |
)
|
| 540 |
+
|
| 541 |
|
| 542 |
transform_btn.click(
|
| 543 |
fn=img_to_image,
|