Raphael commited on
Commit
de3e780
1 Parent(s): 154c8c5

Signed-off-by: Raphael <[email protected]>

Files changed (2) hide show
  1. app.py +11 -5
  2. requirements.txt +1 -0
app.py CHANGED
@@ -114,11 +114,17 @@ def merge_selfie_and_background(selfie, background, mask):
114
 
115
 
116
  def demo(threshold, image, prompt, num_inference_steps):
117
- image = image_preprocess(image)
118
- mask = extract_selfie_mask(threshold, image)
119
- background = generate_background(prompt, num_inference_steps,
120
- image.shape[0], image.shape[1])
121
- output = merge_selfie_and_background(image, background, mask)
 
 
 
 
 
 
122
  return output
123
 
124
 
 
114
 
115
 
116
  def demo(threshold, image, prompt, num_inference_steps):
117
+ LOG.info("Processing image")
118
+ try:
119
+ image = image_preprocess(image)
120
+ mask = extract_selfie_mask(threshold, image)
121
+ background = generate_background(prompt, num_inference_steps,
122
+ image.shape[0], image.shape[1])
123
+ output = merge_selfie_and_background(image, background, mask)
124
+ except Exception as e:
125
+ LOG.error("Some unexpected error occured")
126
+ LOG.exception(e)
127
+ raise
128
  return output
129
 
130
 
requirements.txt CHANGED
@@ -10,3 +10,4 @@ ftfy
10
  accelerate
11
  torch
12
  numpy
 
 
10
  accelerate
11
  torch
12
  numpy
13
+ hf_transfer