Cany-Tam commited on
Commit
0a9b98f
·
1 Parent(s): da86661

Update pages/04_Super_Resolution.py

Browse files
Files changed (1) hide show
  1. pages/04_Super_Resolution.py +12 -9
pages/04_Super_Resolution.py CHANGED
@@ -219,22 +219,23 @@ outscale = st.slider("Image Upscaling Factor", 1, 10, 2)
219
  face_enhance = st.checkbox("Face Enhancement using GFPGAN (Doesn't work for anime images)")
220
 
221
  if input_img:
222
- print(input_img)
223
  input_img = Image.open(input_img)
224
  # Display image properties
225
- cols = st.columns(2)
226
 
227
- cols[0].image(input_img, 'Source Image')
 
228
 
229
  #input_properties = get_image_properties(input_img)
230
  #cols[1].write(input_properties)
231
 
232
  # Output placeholder
233
- output_img = st.empty()
234
 
235
  # Input and output placeholders
236
- input_img = input_img
237
- output_img = st.empty()
238
 
239
  # Buttons
240
  restore = st.button('Restore')
@@ -245,10 +246,12 @@ if restore:
245
  if input_img is not None:
246
  output = realesrgan(input_img, model_name, denoise_strength,
247
  face_enhance, outscale)
248
- output_img.image(output, 'Restored Image')
249
- output_img.download_button(
 
 
250
  label="Download Image",
251
- data=open(output, "rb").read(),
252
  file_name="Image.jpg",
253
  )
254
  else:
 
219
  face_enhance = st.checkbox("Face Enhancement using GFPGAN (Doesn't work for anime images)")
220
 
221
  if input_img:
222
+ #print(input_img)
223
  input_img = Image.open(input_img)
224
  # Display image properties
225
+ col1, col2 = st.columns(2)
226
 
227
+ with col1:
228
+ col1.image(input_img, 'Source Image')
229
 
230
  #input_properties = get_image_properties(input_img)
231
  #cols[1].write(input_properties)
232
 
233
  # Output placeholder
234
+ #output_img = st.empty()
235
 
236
  # Input and output placeholders
237
+ #input_img = input_img
238
+ #output_img = st.empty()
239
 
240
  # Buttons
241
  restore = st.button('Restore')
 
246
  if input_img is not None:
247
  output = realesrgan(input_img, model_name, denoise_strength,
248
  face_enhance, outscale)
249
+ output.save("Image.jpg")
250
+ with col2:
251
+ st.image(output, 'Restored Image')
252
+ st.download_button(
253
  label="Download Image",
254
+ data=open("Image.jpg", "rb"),
255
  file_name="Image.jpg",
256
  )
257
  else: