ohayonguy
commited on
Commit
•
9f5f67d
1
Parent(s):
beeddbb
trying to fix face helper download
Browse files
app.py
CHANGED
@@ -30,6 +30,16 @@ upsampler = RealESRGANer(scale=4, model_path=realesr_model_path, model=model, ti
|
|
30 |
|
31 |
pmrf = MMSERectifiedFlow.from_pretrained('ohayonguy/PMRF_blind_face_image_restoration').to(device)
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
os.makedirs('output', exist_ok=True)
|
34 |
|
35 |
|
@@ -115,7 +125,7 @@ def inference(img, aligned, scale, num_steps):
|
|
115 |
device=device,
|
116 |
model_rootpath=None)
|
117 |
|
118 |
-
has_aligned = True if aligned == '
|
119 |
_, restored_aligned, restored_img = enhance_face(img, face_helper, has_aligned, only_center_face=False,
|
120 |
paste_back=True)
|
121 |
if has_aligned:
|
@@ -151,7 +161,7 @@ css = r"""
|
|
151 |
demo = gr.Interface(
|
152 |
inference, [
|
153 |
gr.Image(type="filepath", label="Input"),
|
154 |
-
gr.Radio(['
|
155 |
gr.Number(label="Rescaling factor (the rescaling factor of the final image)", value=2),
|
156 |
gr.Number(label="Number of flow steps (a higher value leads to better image quality at the expense of runtime)", value=25),
|
157 |
], [
|
|
|
30 |
|
31 |
pmrf = MMSERectifiedFlow.from_pretrained('ohayonguy/PMRF_blind_face_image_restoration').to(device)
|
32 |
|
33 |
+
face_helper_dummy = FaceRestoreHelper(
|
34 |
+
1,
|
35 |
+
face_size=512,
|
36 |
+
crop_ratio=(1, 1),
|
37 |
+
det_model='retinaface_resnet50',
|
38 |
+
save_ext='png',
|
39 |
+
use_parse=True,
|
40 |
+
device=device,
|
41 |
+
model_rootpath=None)
|
42 |
+
|
43 |
os.makedirs('output', exist_ok=True)
|
44 |
|
45 |
|
|
|
125 |
device=device,
|
126 |
model_rootpath=None)
|
127 |
|
128 |
+
has_aligned = True if aligned == 'Yes' else False
|
129 |
_, restored_aligned, restored_img = enhance_face(img, face_helper, has_aligned, only_center_face=False,
|
130 |
paste_back=True)
|
131 |
if has_aligned:
|
|
|
161 |
demo = gr.Interface(
|
162 |
inference, [
|
163 |
gr.Image(type="filepath", label="Input"),
|
164 |
+
gr.Radio(['Yes', 'No'], type="value", value='aligned', label='Is the input an aligned face image?'),
|
165 |
gr.Number(label="Rescaling factor (the rescaling factor of the final image)", value=2),
|
166 |
gr.Number(label="Number of flow steps (a higher value leads to better image quality at the expense of runtime)", value=25),
|
167 |
], [
|