Zongsheng commited on
Commit
2f8be9c
1 Parent(s): d6fbbca

print image path

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -29,6 +29,9 @@ configs.aligned = False
29
  sampler_dist = DifIRSampler(configs)
30
 
31
  def predict(im_path, background_enhance, face_upsample, upscale, started_timesteps):
 
 
 
32
  configs.background_enhance = background_enhance
33
  configs.face_upsample = face_upsample
34
  started_timesteps = int(started_timesteps)
@@ -74,11 +77,8 @@ def predict(im_path, background_enhance, face_upsample, upscale, started_timeste
74
 
75
  return image_restored, str(save_path)
76
 
77
- # im_path = './testdata/whole_imgs/00.jpg'
78
- # predict(im_path, True, True, 3, 100)
79
-
80
  title = "DifFace: Blind Face Restoration with Diffused Error Contraction"
81
- description = r"""<center><img src='./assets/DifFace_Framework.png' alt='DifFace logo'></center>
82
  <b>Official Gradio demo</b> for <a href='https://github.com/zsyOAOA/DifFace' target='_blank'><b>DifFace: Blind Face Restoration with Diffused Error Contraction</b></a>.<br>
83
  🔥 DifFace is a robust face restoration algorithm for old or corrupted photos.<br>
84
  """
@@ -114,13 +114,13 @@ demo = gr.Interface(
114
  predict,
115
  inputs=[
116
  gr.Image(type="filepath", label="Input"),
117
- gr.Checkbox(default=True, label="Background_Enhance"),
118
- gr.Checkbox(default=True, label="Face_Upsample"),
119
- gr.Number(default=2, label="Rescaling_Factor (up to 4)"),
120
  gr.Slider(1, 200, value=100, step=10, label='Realism-Fidelity Trade-off')
121
  ],
122
  outputs=[
123
- gr.outputs.Image(type="numpy", label="Output"),
124
  gr.outputs.File(label="Download the output")
125
  ],
126
  title=title,
 
29
  sampler_dist = DifIRSampler(configs)
30
 
31
  def predict(im_path, background_enhance, face_upsample, upscale, started_timesteps):
32
+ assert isinstance(im_path, str)
33
+ print(f'Processing image: {im_path}...')
34
+
35
  configs.background_enhance = background_enhance
36
  configs.face_upsample = face_upsample
37
  started_timesteps = int(started_timesteps)
 
77
 
78
  return image_restored, str(save_path)
79
 
 
 
 
80
  title = "DifFace: Blind Face Restoration with Diffused Error Contraction"
81
+ description = r"""<center><img src='https://github.com/zsyOAOA/DifFace/blob/master/assets/DifFace_Framework.png' alt='DifFace logo'></center>
82
  <b>Official Gradio demo</b> for <a href='https://github.com/zsyOAOA/DifFace' target='_blank'><b>DifFace: Blind Face Restoration with Diffused Error Contraction</b></a>.<br>
83
  🔥 DifFace is a robust face restoration algorithm for old or corrupted photos.<br>
84
  """
 
114
  predict,
115
  inputs=[
116
  gr.Image(type="filepath", label="Input"),
117
+ gr.Checkbox(value=True, label="Background_Enhance"),
118
+ gr.Checkbox(value=True, label="Face_Upsample"),
119
+ gr.Number(value=2, label="Rescaling_Factor (up to 4)"),
120
  gr.Slider(1, 200, value=100, step=10, label='Realism-Fidelity Trade-off')
121
  ],
122
  outputs=[
123
+ gr.Image(type="numpy", label="Output"),
124
  gr.outputs.File(label="Download the output")
125
  ],
126
  title=title,