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

Update pages/04_Super_Resolution.py

Browse files
Files changed (1) hide show
  1. pages/04_Super_Resolution.py +11 -14
pages/04_Super_Resolution.py CHANGED
@@ -219,23 +219,22 @@ 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
- 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,14 +245,12 @@ if restore:
246
  if input_img is not None:
247
  output = realesrgan(input_img, model_name, denoise_strength,
248
  face_enhance, outscale)
249
- #im = Image.fromarray(output)
250
- #im.save("Image.jpg")
251
- with col2:
252
- st.image(output, f'Restored Image - {output}')
253
- st.download_button(
254
  label="Download Image",
255
- data=open(output, "rb"),
256
- file_name=output
257
  )
258
  else:
259
  st.warning('Upload a file', icon="⚠️")
 
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
  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
+
250
+ st.download_button(
 
 
251
  label="Download Image",
252
+ data=open(output, "rb").read(),
253
+ file_name="Image.jpg",
254
  )
255
  else:
256
  st.warning('Upload a file', icon="⚠️")