Cany-Tam commited on
Commit
cba1192
1 Parent(s): 7be3354

Update pages/05_Image_Denoizer.py

Browse files
Files changed (1) hide show
  1. pages/05_Image_Denoizer.py +12 -13
pages/05_Image_Denoizer.py CHANGED
@@ -214,23 +214,22 @@ outscale = 1
214
  face_enhance = False
215
 
216
  if input_img:
217
- #print(input_img)
218
  input_img = Image.open(input_img)
219
  # Display image properties
220
- col1, col2 = st.columns(2)
221
 
222
- with col1:
223
- st.image(input_img, 'Source Image')
224
 
225
  #input_properties = get_image_properties(input_img)
226
  #cols[1].write(input_properties)
227
 
228
  # Output placeholder
229
- #output_img = st.empty()
230
 
231
  # Input and output placeholders
232
- #input_img = input_img
233
- #output_img = st.empty()
234
 
235
  # Buttons
236
  restore = st.button('Restore')
@@ -241,13 +240,13 @@ if restore:
241
  if input_img is not None:
242
  output = realesrgan(input_img, model_name, denoise_strength,
243
  face_enhance, outscale)
244
- with col2:
245
- st.image(output, f'Restored Image - {output}')
246
- st.download_button(
247
  label="Download Image",
248
- data=open(output, "rb"),
249
- file_name=output
250
- )
251
  else:
252
  st.warning('Upload a file', icon="⚠️")
253
 
 
214
  face_enhance = False
215
 
216
  if input_img:
217
+ print(input_img)
218
  input_img = Image.open(input_img)
219
  # Display image properties
220
+ cols = st.columns(2)
221
 
222
+ cols[0].image(input_img, 'Source Image')
 
223
 
224
  #input_properties = get_image_properties(input_img)
225
  #cols[1].write(input_properties)
226
 
227
  # Output placeholder
228
+ output_img = st.empty()
229
 
230
  # Input and output placeholders
231
+ input_img = input_img
232
+ output_img = st.empty()
233
 
234
  # Buttons
235
  restore = st.button('Restore')
 
240
  if input_img is not None:
241
  output = realesrgan(input_img, model_name, denoise_strength,
242
  face_enhance, outscale)
243
+ output_img.image(output, 'Restored Image')
244
+
245
+ st.download_button(
246
  label="Download Image",
247
+ data=open(output, "rb").read(),
248
+ file_name="Image.jpg"
249
+ )
250
  else:
251
  st.warning('Upload a file', icon="⚠️")
252