tuan2308 commited on
Commit
5673b84
·
verified ·
1 Parent(s): 7f9201f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -98,14 +98,10 @@ def realesrgan(img, model_name, denoise_strength, face_enhance, outscale):
98
  print('Error', error)
99
  print('If you encounter CUDA out of memory, try to set --tile with a smaller number.')
100
  else:
101
- # Save restored image and return it to the output Image component
102
- if img_mode == 'RGBA': # RGBA images should be saved in png format
103
- extension = 'jpg'
104
- else:
105
- extension = 'jpg'
106
 
107
  out_filename = f"output_{rnd_string(8)}.{extension}"
108
- cv2.imwrite(out_filename, output)
109
  global last_file
110
  last_file = out_filename
111
  return out_filename
 
98
  print('Error', error)
99
  print('If you encounter CUDA out of memory, try to set --tile with a smaller number.')
100
  else:
101
+ extension = 'jpg'
 
 
 
 
102
 
103
  out_filename = f"output_{rnd_string(8)}.{extension}"
104
+ cv2.imwrite(out_filename, output, [int(cv2.IMWRITE_JPEG_QUALITY), 90]) # 90 là chất lượng JPEG (có thể chỉnh)
105
  global last_file
106
  last_file = out_filename
107
  return out_filename