Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -48,10 +48,10 @@ os.makedirs('output', exist_ok=True)
|
|
48 |
# def inference(img, version, scale, weight):
|
49 |
def inference(img, version, scale, blur_face):
|
50 |
blur_face = int(blur_face)
|
51 |
-
if blur_face < 3:
|
52 |
-
blur_face = 3
|
53 |
if blur_face % 2 != 1:
|
54 |
blur_face += 1
|
|
|
|
|
55 |
# weight /= 100
|
56 |
print(img, version, scale)
|
57 |
if scale > 4:
|
@@ -95,7 +95,8 @@ def inference(img, version, scale, blur_face):
|
|
95 |
def new_align_warp_face(*args, **kwargs):
|
96 |
align_warp_face(*args, **kwargs) # save_cropped_path
|
97 |
face_helper.org_cropped_faces = face_helper.cropped_faces
|
98 |
-
|
|
|
99 |
print("find face count:", len(face_helper.cropped_faces))
|
100 |
|
101 |
face_helper.align_warp_face = new_align_warp_face
|
@@ -160,6 +161,6 @@ demo = gr.Interface(
|
|
160 |
# examples=[['AI-generate.jpg', 'v1.4', 2, 50], ['lincoln.jpg', 'v1.4', 2, 50], ['Blake_Lively.jpg', 'v1.4', 2, 50],
|
161 |
# ['10045.png', 'v1.4', 2, 50]]).launch()
|
162 |
examples=[['HanamichiSakuragi.jpg', 'v1.4', 2, 31], ['LiShiming.jpg', 'v1.4', 2, 3], ['QianLong.jpg', 'v1.4', 2, 3],
|
163 |
-
['10045.png', 'v1.4', 2,
|
164 |
demo.queue(concurrency_count=4)
|
165 |
demo.launch()
|
|
|
48 |
# def inference(img, version, scale, weight):
|
49 |
def inference(img, version, scale, blur_face):
|
50 |
blur_face = int(blur_face)
|
|
|
|
|
51 |
if blur_face % 2 != 1:
|
52 |
blur_face += 1
|
53 |
+
if blur_face < 3:
|
54 |
+
blur_face = 0
|
55 |
# weight /= 100
|
56 |
print(img, version, scale)
|
57 |
if scale > 4:
|
|
|
95 |
def new_align_warp_face(*args, **kwargs):
|
96 |
align_warp_face(*args, **kwargs) # save_cropped_path
|
97 |
face_helper.org_cropped_faces = face_helper.cropped_faces
|
98 |
+
if blur_face >= 3:
|
99 |
+
face_helper.cropped_faces = [cv2.GaussianBlur(e, (blur_face, blur_face), 0) for e in face_helper.cropped_faces]
|
100 |
print("find face count:", len(face_helper.cropped_faces))
|
101 |
|
102 |
face_helper.align_warp_face = new_align_warp_face
|
|
|
161 |
# examples=[['AI-generate.jpg', 'v1.4', 2, 50], ['lincoln.jpg', 'v1.4', 2, 50], ['Blake_Lively.jpg', 'v1.4', 2, 50],
|
162 |
# ['10045.png', 'v1.4', 2, 50]]).launch()
|
163 |
examples=[['HanamichiSakuragi.jpg', 'v1.4', 2, 31], ['LiShiming.jpg', 'v1.4', 2, 3], ['QianLong.jpg', 'v1.4', 2, 3],
|
164 |
+
['10045.png', 'v1.4', 2, 0]])
|
165 |
demo.queue(concurrency_count=4)
|
166 |
demo.launch()
|