doevent commited on
Commit
cf8fbc0
·
verified ·
1 Parent(s): 8f30ed0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -2,6 +2,7 @@ import torch
2
  from PIL import Image
3
  import gradio as gr
4
  import spaces
 
5
  from KandiSuperRes import get_SR_pipeline
6
 
7
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
@@ -19,9 +20,10 @@ def inference(image, size):
19
  result = sr_pipe2x(image)
20
  else:
21
  result = sr_pipe4x(image)
22
-
23
  print(f"Image size ({device}): {size} ... OK")
24
- return result
 
25
 
26
 
27
  title = "KandiSuperRes - diffusion model for super resolution"
@@ -35,7 +37,7 @@ gr.Interface(inference,
35
  type="value",
36
  value='2x',
37
  label='Resolution model')],
38
- gr.Image(type="filepath", label="Output", format="png"),
39
  title=title,
40
  description=description,
41
  article=article,
 
2
  from PIL import Image
3
  import gradio as gr
4
  import spaces
5
+ from gradio_imageslider import ImageSlider
6
  from KandiSuperRes import get_SR_pipeline
7
 
8
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
 
20
  result = sr_pipe2x(image)
21
  else:
22
  result = sr_pipe4x(image)
23
+
24
  print(f"Image size ({device}): {size} ... OK")
25
+
26
+ return (image, result)
27
 
28
 
29
  title = "KandiSuperRes - diffusion model for super resolution"
 
37
  type="value",
38
  value='2x',
39
  label='Resolution model')],
40
+ ImageSlider(type="filepath", label="Output", format="png"),
41
  title=title,
42
  description=description,
43
  article=article,