Spaces:
Runtime error
Runtime error
fix
Browse files
app.py
CHANGED
@@ -67,18 +67,17 @@ 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.ones((output_size[1], output_size[0], 3), dtype=np.uint8) * 255
|
75 |
|
76 |
-
x_offset =
|
77 |
-
y_offset =
|
78 |
|
79 |
background[y_offset:y_offset+new_size[1], x_offset:x_offset+new_size[0]] = resized_image
|
80 |
-
|
81 |
-
background = background.astype(np.uint8)
|
82 |
|
83 |
return background
|
84 |
|
@@ -114,6 +113,9 @@ def execute(image, prompt):
|
|
114 |
|
115 |
imgs = [ random_positioning(img), random_positioning(img)]
|
116 |
|
|
|
|
|
|
|
117 |
pipe.load_lora_weights("XLabs-AI/flux-RealismLora", weight_name='lora.safetensors')
|
118 |
response = []
|
119 |
|
@@ -147,8 +149,12 @@ def execute(image, prompt):
|
|
147 |
|
148 |
return response
|
149 |
|
|
|
|
|
150 |
iface = gr.Interface(
|
151 |
fn=execute,
|
|
|
|
|
152 |
inputs=[
|
153 |
gr.Image(type="filepath"),
|
154 |
gr.Textbox(label="Prompt")
|
|
|
67 |
|
68 |
scale_factor = random.uniform(0.5, 1.0)
|
69 |
|
70 |
+
new_size = (int(input_image.shape[1] * scale_factor), int(input_image.shape[0] * scale_factor))
|
71 |
|
72 |
+
resized_image = cv2.resize(input_image, new_size, interpolation=cv2.INTER_AREA)
|
73 |
|
74 |
background = np.ones((output_size[1], output_size[0], 3), dtype=np.uint8) * 255
|
75 |
|
76 |
+
x_offset = (output_size[0] - new_size[0]) // 2
|
77 |
+
y_offset = (output_size[1] - new_size[1]) // 2
|
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 |
|
|
|
113 |
|
114 |
imgs = [ random_positioning(img), 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 = []
|
121 |
|
|
|
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(
|
155 |
fn=execute,
|
156 |
+
description=description,
|
157 |
+
title=title,
|
158 |
inputs=[
|
159 |
gr.Image(type="filepath"),
|
160 |
gr.Textbox(label="Prompt")
|