Cany-Tam commited on
Commit
7187f99
·
1 Parent(s): 0500e4d

Update pages/05_Image_Denoizer.py

Browse files
Files changed (1) hide show
  1. pages/05_Image_Denoizer.py +15 -11
pages/05_Image_Denoizer.py CHANGED
@@ -214,22 +214,23 @@ 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
- 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,13 +241,16 @@ if 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
 
 
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
  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, 'Restored Image')
246
 
247
+ with col2:
248
+ st.image(output, f'Restored Image - {output}')
249
+ st.download_button(
250
  label="Download Image",
251
+ data=open(output, "rb"),
252
+ file_name=output
253
+ )
254
  else:
255
  st.warning('Upload a file', icon="⚠️")
256