jbilcke-hf HF staff commited on
Commit
61690e3
·
verified ·
1 Parent(s): 52d2c68

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +7 -6
handler.py CHANGED
@@ -269,12 +269,13 @@ class EndpointHandler:
269
  input_image = inputs.get("image")
270
 
271
  params = data.get("parameters", dict())
272
-
273
- if not input_prompt:
274
- raise ValueError("The prompt should not be empty")
275
-
276
- logger.info(f"Prompt: {input_prompt}")
277
-
 
278
  logger.info(f"Raw parameters:")
279
  pprint.pprint(params)
280
 
 
269
  input_image = inputs.get("image")
270
 
271
  params = data.get("parameters", dict())
272
+
273
+ if not input_image and not input_prompt:
274
+ raise ValueError("Either prompt or image must be provided")
275
+
276
+ if input_prompt:
277
+ logger.info(f"Prompt: {input_prompt}")
278
+
279
  logger.info(f"Raw parameters:")
280
  pprint.pprint(params)
281