Himanshu-AT commited on
Commit
810339f
1 Parent(s): d17f401

fix: handle image input types in leffa_predict function

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -46,8 +46,17 @@ print("Model downloaded, ready to serve!")
46
  def leffa_predict(src_image_path, ref_image_path, control_type):
47
  assert control_type in [
48
  "virtual_tryon", "pose_transfer"], "Invalid control type: {}".format(control_type)
49
- src_image = Image.open(src_image_path)
50
- ref_image = Image.open(ref_image_path)
 
 
 
 
 
 
 
 
 
51
  src_image = resize_and_center(src_image, 768, 1024)
52
  ref_image = resize_and_center(ref_image, 768, 1024)
53
 
 
46
  def leffa_predict(src_image_path, ref_image_path, control_type):
47
  assert control_type in [
48
  "virtual_tryon", "pose_transfer"], "Invalid control type: {}".format(control_type)
49
+
50
+ if isinstance(src_image_path, str):
51
+ src_image = Image.open(src_image_path)
52
+ else:
53
+ src_image = src_image_path
54
+
55
+ if isinstance(ref_image_path, str):
56
+ ref_image = Image.open(ref_image_path)
57
+ else:
58
+ ref_image = ref_image_path
59
+
60
  src_image = resize_and_center(src_image, 768, 1024)
61
  ref_image = resize_and_center(ref_image, 768, 1024)
62