Xintao commited on
Commit
60126cc
1 Parent(s): 3064e13

update: remove codeformer

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -74,9 +74,9 @@ def inference(img, version, scale, weight):
74
  elif version == 'RestoreFormer':
75
  face_enhancer = GFPGANer(
76
  model_path='RestoreFormer.pth', upscale=2, arch='RestoreFormer', channel_multiplier=2, bg_upsampler=upsampler)
77
- elif version == 'CodeFormer':
78
- face_enhancer = GFPGANer(
79
- model_path='CodeFormer.pth', upscale=2, arch='CodeFormer', channel_multiplier=2, bg_upsampler=upsampler)
80
 
81
  try:
82
  _, _, output = face_enhancer.enhance(img, has_aligned=False, only_center_face=False, paste_back=True, weight=weight)
@@ -124,9 +124,10 @@ If you have any question, please email 📧 `[email protected]` or `xintao
124
  gr.Interface(
125
  inference, [
126
  gr.inputs.Image(type="filepath", label="Input"),
127
- gr.inputs.Radio(['v1.2', 'v1.3', 'v1.4', 'RestoreFormer', 'CodeFormer'], type="value", default='v1.4', label='version'),
 
128
  gr.inputs.Number(label="Rescaling factor", default=2),
129
- gr.Slider(0, 100, label='Weight, only for CodeFormer. 0 for better quality, 100 for better identity', default=50)
130
  ], [
131
  gr.outputs.Image(type="numpy", label="Output (The whole image)"),
132
  gr.outputs.File(label="Download the output image")
@@ -134,5 +135,7 @@ gr.Interface(
134
  title=title,
135
  description=description,
136
  article=article,
137
- examples=[['AI-generate.jpg', 'v1.4', 2, 50], ['lincoln.jpg', 'v1.4', 2, 50], ['Blake_Lively.jpg', 'v1.4', 2, 50],
138
- ['10045.png', 'v1.4', 2, 50]]).launch()
 
 
 
74
  elif version == 'RestoreFormer':
75
  face_enhancer = GFPGANer(
76
  model_path='RestoreFormer.pth', upscale=2, arch='RestoreFormer', channel_multiplier=2, bg_upsampler=upsampler)
77
+ # elif version == 'CodeFormer':
78
+ # face_enhancer = GFPGANer(
79
+ # model_path='CodeFormer.pth', upscale=2, arch='CodeFormer', channel_multiplier=2, bg_upsampler=upsampler)
80
 
81
  try:
82
  _, _, output = face_enhancer.enhance(img, has_aligned=False, only_center_face=False, paste_back=True, weight=weight)
 
124
  gr.Interface(
125
  inference, [
126
  gr.inputs.Image(type="filepath", label="Input"),
127
+ # gr.inputs.Radio(['v1.2', 'v1.3', 'v1.4', 'RestoreFormer', 'CodeFormer'], type="value", default='v1.4', label='version'),
128
+ gr.inputs.Radio(['v1.2', 'v1.3', 'v1.4', 'RestoreFormer'], type="value", default='v1.4', label='version'),
129
  gr.inputs.Number(label="Rescaling factor", default=2),
130
+ # gr.Slider(0, 100, label='Weight, only for CodeFormer. 0 for better quality, 100 for better identity', default=50)
131
  ], [
132
  gr.outputs.Image(type="numpy", label="Output (The whole image)"),
133
  gr.outputs.File(label="Download the output image")
 
135
  title=title,
136
  description=description,
137
  article=article,
138
+ # examples=[['AI-generate.jpg', 'v1.4', 2, 50], ['lincoln.jpg', 'v1.4', 2, 50], ['Blake_Lively.jpg', 'v1.4', 2, 50],
139
+ # ['10045.png', 'v1.4', 2, 50]]).launch()
140
+ examples=[['AI-generate.jpg', 'v1.4', 2], ['lincoln.jpg', 'v1.4', 2], ['Blake_Lively.jpg', 'v1.4', 2],
141
+ ['10045.png', 'v1.4', 2]]).launch()