Spaces:
Sleeping
Sleeping
Update text_integration.py
Browse files- text_integration.py +11 -3
text_integration.py
CHANGED
|
@@ -25,9 +25,17 @@ def add_text_to_image(image, text, text_x, text_y, font_size=36, font_color="#FF
|
|
| 25 |
|
| 26 |
def set_text_position(img, evt: gr.SelectData):
|
| 27 |
"""Setzt Textposition durch Klick/Touch im Vorschau-Bild"""
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
def create_text_integration_section_t2i():
|
| 33 |
"""Erstellt die UI-Komponenten für Text-Integration in Text-zu-Bild"""
|
|
|
|
| 25 |
|
| 26 |
def set_text_position(img, evt: gr.SelectData):
|
| 27 |
"""Setzt Textposition durch Klick/Touch im Vorschau-Bild"""
|
| 28 |
+
if evt is None:
|
| 29 |
+
print("Kein gültiger Klick-Event")
|
| 30 |
+
return 100, 100 # Fallback-Position
|
| 31 |
+
|
| 32 |
+
try:
|
| 33 |
+
x, y = evt.index
|
| 34 |
+
print(f"Textposition gesetzt: ({x}, {y})")
|
| 35 |
+
return x, y
|
| 36 |
+
except Exception as e:
|
| 37 |
+
print(f"Fehler beim Verarbeiten der Textposition: {e}")
|
| 38 |
+
return 100, 100 # Fallback-Position
|
| 39 |
|
| 40 |
def create_text_integration_section_t2i():
|
| 41 |
"""Erstellt die UI-Komponenten für Text-Integration in Text-zu-Bild"""
|