Spaces:
Running
on
Zero
Running
on
Zero
rollback
Browse files
app.py
CHANGED
@@ -67,17 +67,18 @@ def random_positioning(input, output_size=(1024, 1024)):
|
|
67 |
|
68 |
scale_factor = random.uniform(0.5, 1.0)
|
69 |
|
70 |
-
new_size = (int(
|
71 |
|
72 |
-
resized_image = cv2.resize(
|
73 |
|
74 |
-
background = np.
|
75 |
|
76 |
-
x_offset = (output_size[0] - new_size[0])
|
77 |
-
y_offset = (output_size[1] - new_size[1])
|
78 |
|
79 |
background[y_offset:y_offset+new_size[1], x_offset:x_offset+new_size[0]] = resized_image
|
80 |
-
|
|
|
81 |
|
82 |
return background
|
83 |
|
@@ -111,10 +112,7 @@ def execute(image, prompt):
|
|
111 |
img = cv2.imread(image)
|
112 |
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
113 |
|
114 |
-
imgs = [ random_positioning(img)
|
115 |
-
|
116 |
-
# Created by Fountai
|
117 |
-
# https://x.com/EuFountai
|
118 |
|
119 |
pipe.load_lora_weights("XLabs-AI/flux-RealismLora", weight_name='lora.safetensors')
|
120 |
response = []
|
@@ -149,6 +147,8 @@ def execute(image, prompt):
|
|
149 |
|
150 |
return response
|
151 |
|
|
|
|
|
152 |
description = "This is an unofficial implementation of the ip face adapter for FLUX DEV and does not explicitly follow the ip face model, I created a wrapper with inpaint and mediapipe, I like using Fake IP Adapter"
|
153 |
title = "Flux IP Face Adapter"
|
154 |
iface = gr.Interface(
|
@@ -164,3 +164,5 @@ iface = gr.Interface(
|
|
164 |
|
165 |
iface.launch(share=True, debug=True)
|
166 |
|
|
|
|
|
|
67 |
|
68 |
scale_factor = random.uniform(0.5, 1.0)
|
69 |
|
70 |
+
new_size = (int(input.shape[1] * scale_factor), int(input.shape[0] * scale_factor))
|
71 |
|
72 |
+
resized_image = cv2.resize(input, new_size, interpolation=cv2.INTER_AREA)
|
73 |
|
74 |
+
background = np.zeros((output_size[1], output_size[0], 3), dtype=np.uint8)
|
75 |
|
76 |
+
x_offset = random.randint(0, output_size[0] - new_size[0])
|
77 |
+
y_offset = random.randint(0, output_size[1] - new_size[1])
|
78 |
|
79 |
background[y_offset:y_offset+new_size[1], x_offset:x_offset+new_size[0]] = resized_image
|
80 |
+
background = np.clip(background, 0, 255)
|
81 |
+
background = background.astype(np.uint8)
|
82 |
|
83 |
return background
|
84 |
|
|
|
112 |
img = cv2.imread(image)
|
113 |
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
114 |
|
115 |
+
imgs = [ random_positioning(img)]
|
|
|
|
|
|
|
116 |
|
117 |
pipe.load_lora_weights("XLabs-AI/flux-RealismLora", weight_name='lora.safetensors')
|
118 |
response = []
|
|
|
147 |
|
148 |
return response
|
149 |
|
150 |
+
# Created by Fountai
|
151 |
+
# https://x.com/EuFountai
|
152 |
description = "This is an unofficial implementation of the ip face adapter for FLUX DEV and does not explicitly follow the ip face model, I created a wrapper with inpaint and mediapipe, I like using Fake IP Adapter"
|
153 |
title = "Flux IP Face Adapter"
|
154 |
iface = gr.Interface(
|
|
|
164 |
|
165 |
iface.launch(share=True, debug=True)
|
166 |
|
167 |
+
iface.launch(share=True, debug=True)
|
168 |
+
|