k-kotetsu commited on
Commit
8509709
1 Parent(s): e39206f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -18
app.py CHANGED
@@ -9,9 +9,6 @@ from basicsr.utils.download_util import load_file_from_url
9
  from realesrgan import RealESRGANer
10
  from realesrgan.archs.srvgg_arch import SRVGGNetCompact
11
 
12
- from PIL import Image
13
- from PIL.PngImagePlugin import PngInfo
14
-
15
 
16
  last_file = None
17
  img_mode = "RGBA"
@@ -87,12 +84,6 @@ def realesrgan(img, model_name, denoise_strength, face_enhance, outscale, ext):
87
  channel_multiplier=2,
88
  bg_upsampler=upsampler)
89
 
90
- # parameters
91
- if ext == 'png':
92
- parameters = img.text['parameters']
93
- else:
94
- parameters = ''
95
-
96
  # Convert the input PIL image to cv2 image, so that it can be processed by realesrgan
97
  cv_img = numpy.array(img)
98
  img = cv2.cvtColor(cv_img, cv2.COLOR_RGBA2BGRA)
@@ -115,11 +106,6 @@ def realesrgan(img, model_name, denoise_strength, face_enhance, outscale, ext):
115
 
116
  #out_filename = f"output_{rnd_string(8)}.{extension}"
117
  out_filename = f"output_{rnd_string(8)}." + ext
118
- #if parameters != '':
119
- # metadata = PngInfo()
120
- # metadata.add_text("parameters", parameters)
121
- # cv2.imwrite(out_filename, output, [int(cv2.IMWRITE_PNG_COMPRESSION), 0], pnginfo=metadata)
122
- #else:
123
  cv2.imwrite(out_filename, output)
124
  global last_file
125
  last_file = out_filename
@@ -183,9 +169,6 @@ def image_properties(img):
183
  properties = f"Width: {img.size[0]}, Height: {img.size[1]} | Color Mode: {img_mode}"
184
  return properties
185
 
186
- def image_metadata(img):
187
- return img.text['parameters']
188
-
189
 
190
  def main():
191
  # Gradio Interface
@@ -215,7 +198,6 @@ def main():
215
  with gr.Group():
216
  input_image = gr.Image(label="Source Image", type="pil", image_mode="RGBA")
217
  input_image_properties = gr.Textbox(label="Image Properties", max_lines=1)
218
- #input_image_metadata = gr.Textbox(label="Image Metadata", max_lines=1)
219
  output_image = gr.Image(label="Restored Image", image_mode="RGBA", show_share_button=False)
220
  with gr.Row():
221
  restore_btn = gr.Button("Upscale")
 
9
  from realesrgan import RealESRGANer
10
  from realesrgan.archs.srvgg_arch import SRVGGNetCompact
11
 
 
 
 
12
 
13
  last_file = None
14
  img_mode = "RGBA"
 
84
  channel_multiplier=2,
85
  bg_upsampler=upsampler)
86
 
 
 
 
 
 
 
87
  # Convert the input PIL image to cv2 image, so that it can be processed by realesrgan
88
  cv_img = numpy.array(img)
89
  img = cv2.cvtColor(cv_img, cv2.COLOR_RGBA2BGRA)
 
106
 
107
  #out_filename = f"output_{rnd_string(8)}.{extension}"
108
  out_filename = f"output_{rnd_string(8)}." + ext
 
 
 
 
 
109
  cv2.imwrite(out_filename, output)
110
  global last_file
111
  last_file = out_filename
 
169
  properties = f"Width: {img.size[0]}, Height: {img.size[1]} | Color Mode: {img_mode}"
170
  return properties
171
 
 
 
 
172
 
173
  def main():
174
  # Gradio Interface
 
198
  with gr.Group():
199
  input_image = gr.Image(label="Source Image", type="pil", image_mode="RGBA")
200
  input_image_properties = gr.Textbox(label="Image Properties", max_lines=1)
 
201
  output_image = gr.Image(label="Restored Image", image_mode="RGBA", show_share_button=False)
202
  with gr.Row():
203
  restore_btn = gr.Button("Upscale")