Raphael
commited on
Commit
•
de3e780
1
Parent(s):
154c8c5
wip
Browse filesSigned-off-by: Raphael <[email protected]>
- app.py +11 -5
- 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 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|