Spaces:
Sleeping
Sleeping
Update text_integration.py
Browse files- text_integration.py +17 -13
text_integration.py
CHANGED
|
@@ -41,15 +41,17 @@ def create_text_preview(image, text, text_x, text_y, font_size=36, font_color="#
|
|
| 41 |
preview = image.copy()
|
| 42 |
draw = ImageDraw.Draw(preview)
|
| 43 |
|
| 44 |
-
#
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# Text zeichnen wenn vorhanden
|
| 55 |
if text:
|
|
@@ -97,8 +99,9 @@ def create_text_integration_section_t2i():
|
|
| 97 |
)
|
| 98 |
|
| 99 |
with gr.Row():
|
| 100 |
-
|
| 101 |
-
|
|
|
|
| 102 |
|
| 103 |
with gr.Row():
|
| 104 |
text_btn_t2i = gr.Button("📝 Text auf generiertes Bild", variant="secondary")
|
|
@@ -120,8 +123,9 @@ def create_text_integration_section_i2i():
|
|
| 120 |
)
|
| 121 |
|
| 122 |
with gr.Row():
|
| 123 |
-
|
| 124 |
-
|
|
|
|
| 125 |
|
| 126 |
with gr.Row():
|
| 127 |
target_selector = gr.Radio(
|
|
|
|
| 41 |
preview = image.copy()
|
| 42 |
draw = ImageDraw.Draw(preview)
|
| 43 |
|
| 44 |
+
# Nur roten Marker zeichnen wenn Text vorhanden UND Position nicht Standard (100,100)
|
| 45 |
+
if text and (text_x != 100 or text_y != 100):
|
| 46 |
+
# Rote Marker an Textposition
|
| 47 |
+
marker_radius = 8
|
| 48 |
+
marker_color = (255, 0, 0)
|
| 49 |
+
draw.ellipse([
|
| 50 |
+
text_x - marker_radius,
|
| 51 |
+
text_y - marker_radius,
|
| 52 |
+
text_x + marker_radius,
|
| 53 |
+
text_y + marker_radius
|
| 54 |
+
], fill=marker_color)
|
| 55 |
|
| 56 |
# Text zeichnen wenn vorhanden
|
| 57 |
if text:
|
|
|
|
| 99 |
)
|
| 100 |
|
| 101 |
with gr.Row():
|
| 102 |
+
# Start mit None statt 100, damit kein Marker an Standard-Position
|
| 103 |
+
text_x_t2i = gr.Number(value=None, visible=False)
|
| 104 |
+
text_y_t2i = gr.Number(value=None, visible=False)
|
| 105 |
|
| 106 |
with gr.Row():
|
| 107 |
text_btn_t2i = gr.Button("📝 Text auf generiertes Bild", variant="secondary")
|
|
|
|
| 123 |
)
|
| 124 |
|
| 125 |
with gr.Row():
|
| 126 |
+
# Start mit None statt 100, damit kein Marker an Standard-Position
|
| 127 |
+
text_x_i2i = gr.Number(value=None, visible=False)
|
| 128 |
+
text_y_i2i = gr.Number(value=None, visible=False)
|
| 129 |
|
| 130 |
with gr.Row():
|
| 131 |
target_selector = gr.Radio(
|