enesbol commited on
Commit
6c8a104
·
1 Parent(s): 6396035

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +8 -9
handler.py CHANGED
@@ -173,7 +173,7 @@ class EndpointHandler():
173
 
174
  def add_logo_to_image(base_image_path, logo_path, corner_radius=30):
175
 
176
- base_image = Image.open("./1.png")
177
  smoothed_image = smooth_corners(base_image, radius=30)
178
 
179
  # Create a white background with the same size as the original image
@@ -185,7 +185,7 @@ class EndpointHandler():
185
  result_image.paste(smoothed_image, (0, 0), smoothed_image)
186
 
187
 
188
- logo_path = '/kaggle/input/logo-test/Small logo.png'
189
 
190
  # Load the logo image
191
  logo = Image.open(logo_path)
@@ -325,26 +325,25 @@ class EndpointHandler():
325
 
326
  return result_template
327
 
328
-
329
  def create_image_template(
330
  base_image_path,
331
  logo_path,
332
 
333
  punchline_text,
334
- punchline_text_color=(0, 0, 255),
335
  punchline_text_max_width=550,
336
  spacing_image_text=0,
337
 
338
- button_color=(0, 255, 0),
339
  button_text="Call Action Text Here! >",
340
  button_font=cv2.FONT_HERSHEY_TRIPLEX,
341
- button_font_scale=0.6,
342
  button_font_thickness=1,
343
- button_text_color=(0, 0, 255),
344
 
345
  spacing_between_punchline_and_button=10,
346
- corner_radius=30,
347
- ):
348
 
349
 
350
  punchline_text_color = tuple(int(punchline_text_color[i:i+2], 16) for i in (1, 3, 5))
 
173
 
174
  def add_logo_to_image(base_image_path, logo_path, corner_radius=30):
175
 
176
+ base_image = Image.open(base_image_path)
177
  smoothed_image = smooth_corners(base_image, radius=30)
178
 
179
  # Create a white background with the same size as the original image
 
185
  result_image.paste(smoothed_image, (0, 0), smoothed_image)
186
 
187
 
188
+ logo_path = logo_path
189
 
190
  # Load the logo image
191
  logo = Image.open(logo_path)
 
325
 
326
  return result_template
327
 
 
328
  def create_image_template(
329
  base_image_path,
330
  logo_path,
331
 
332
  punchline_text,
333
+ punchline_text_color="#008000",
334
  punchline_text_max_width=550,
335
  spacing_image_text=0,
336
 
337
+ button_color="#008000",
338
  button_text="Call Action Text Here! >",
339
  button_font=cv2.FONT_HERSHEY_TRIPLEX,
340
+ button_font_scale=0.7,
341
  button_font_thickness=1,
342
+ button_text_color="#FFFFFF",
343
 
344
  spacing_between_punchline_and_button=10,
345
+ corner_radius=30,):
346
+
347
 
348
 
349
  punchline_text_color = tuple(int(punchline_text_color[i:i+2], 16) for i in (1, 3, 5))