yamildiego commited on
Commit
74a33c4
·
1 Parent(s): 9617251

added logger

Browse files
Files changed (1) hide show
  1. handler.py +11 -7
handler.py CHANGED
@@ -95,11 +95,10 @@ class EndpointHandler():
95
  )
96
 
97
  def __call__(self, data):
98
- # Now you can use logger.info, logger.warning, etc.
99
- logger.info("This is an info message")
100
- logger.warning("This is a warning message")
101
 
102
- print("Start generating image...")
 
 
103
  def create_image(
104
  image_pil,
105
  input_image,
@@ -114,6 +113,7 @@ class EndpointHandler():
114
  neg_content_prompt=None,
115
  neg_content_scale=0,
116
  ):
 
117
  print("Creating seed")
118
  seed = random.randint(0, MAX_SEED) if seed == -1 else seed
119
  # if target == "Load original IP-Adapter":
@@ -222,7 +222,8 @@ class EndpointHandler():
222
  return input_image
223
 
224
 
225
- print("functions loaded...")
 
226
 
227
  style_image_url = "https://huggingface.co/spaces/radames/InstantStyle-SDXL-Lightning/resolve/main/assets/0.jpg"
228
  response = requests.get(style_image_url)
@@ -233,11 +234,13 @@ class EndpointHandler():
233
  prompt = "A Art Deco style artwork of tennis court with tennis balls and rackets, a modern car, (featuring Notre Dame Cathedral:1.5)"
234
  scale =2.0
235
  control_scale =0.0
236
-
 
237
  print("Parameters loaded...")
238
 
239
  try:
240
-
 
241
  print("Generating image...")
242
 
243
  return create_image(
@@ -255,5 +258,6 @@ class EndpointHandler():
255
  neg_content_scale=0,
256
  )
257
  except Exception as e:
 
258
  print(f"123 Error during image generation: {str(e)}")
259
  return None
 
95
  )
96
 
97
  def __call__(self, data):
 
 
 
98
 
99
+ logger.info("Starting image generation...")
100
+ print("Starting image generation...")
101
+
102
  def create_image(
103
  image_pil,
104
  input_image,
 
113
  neg_content_prompt=None,
114
  neg_content_scale=0,
115
  ):
116
+ logger.info("Creating seed...")
117
  print("Creating seed")
118
  seed = random.randint(0, MAX_SEED) if seed == -1 else seed
119
  # if target == "Load original IP-Adapter":
 
222
  return input_image
223
 
224
 
225
+ logger.info("Functions loaded...")
226
+ print("Functions loaded...")
227
 
228
  style_image_url = "https://huggingface.co/spaces/radames/InstantStyle-SDXL-Lightning/resolve/main/assets/0.jpg"
229
  response = requests.get(style_image_url)
 
234
  prompt = "A Art Deco style artwork of tennis court with tennis balls and rackets, a modern car, (featuring Notre Dame Cathedral:1.5)"
235
  scale =2.0
236
  control_scale =0.0
237
+
238
+ logger.info("Parameters loaded...")
239
  print("Parameters loaded...")
240
 
241
  try:
242
+
243
+ logger.info("Generating image...")
244
  print("Generating image...")
245
 
246
  return create_image(
 
258
  neg_content_scale=0,
259
  )
260
  except Exception as e:
261
+ logger.info(f"123 Error during image generation: {str(e)}")
262
  print(f"123 Error during image generation: {str(e)}")
263
  return None