gy65896 commited on
Commit
d049335
1 Parent(s): 82386aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -6,6 +6,7 @@ from PIL import Image
6
  import numpy as np
7
  from utils.utils import load_restore_ckpt, load_embedder_ckpt
8
  import os
 
9
 
10
  # Enforce CPU usage
11
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
@@ -48,7 +49,7 @@ def enhance_image(image, degradation_type=None):
48
  enhanced_tensor = restorer(input_tensor, text_embedding)
49
 
50
  # Postprocess the output
51
- return postprocess_image(enhanced_tensor), text
52
 
53
  # Define the Gradio interface
54
  def inference(image, degradation_type=None):
@@ -72,7 +73,10 @@ interface = gr.Interface(
72
  'haze_snow', 'low_haze_rain', 'low_haze_snow'], label="Degradation Type", value="auto") # Manual or auto degradation
73
  ],
74
  outputs=[
75
- gr.Image(type="pil"), # Enhanced image output
 
 
 
76
  gr.Textbox(label="Degradation Type") # Display the estimated degradation type
77
  ],
78
  title="Image Restoration with OneRestore",
 
6
  import numpy as np
7
  from utils.utils import load_restore_ckpt, load_embedder_ckpt
8
  import os
9
+ from gradio_imageslider import ImageSlider
10
 
11
  # Enforce CPU usage
12
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
49
  enhanced_tensor = restorer(input_tensor, text_embedding)
50
 
51
  # Postprocess the output
52
+ return (image, postprocess_image(enhanced_tensor)), text
53
 
54
  # Define the Gradio interface
55
  def inference(image, degradation_type=None):
 
73
  'haze_snow', 'low_haze_rain', 'low_haze_snow'], label="Degradation Type", value="auto") # Manual or auto degradation
74
  ],
75
  outputs=[
76
+ ImageSlider(label="Restored Image",
77
+ type="pil",
78
+ show_download_button=True,
79
+ ), # Enhanced image outputImageSlider(type="pil", show_download_button=True, ),
80
  gr.Textbox(label="Degradation Type") # Display the estimated degradation type
81
  ],
82
  title="Image Restoration with OneRestore",