Spaces:
Running
on
T4
Running
on
T4
added gradio_imageslider custom component
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import torch
|
|
| 7 |
import numpy as np
|
| 8 |
import yaml
|
| 9 |
from huggingface_hub import hf_hub_download
|
| 10 |
-
|
| 11 |
|
| 12 |
## local code
|
| 13 |
from models import instructir
|
|
@@ -80,8 +80,7 @@ def process_img (image, prompt):
|
|
| 80 |
restored_img = np.clip(restored_img, 0. , 1.)
|
| 81 |
|
| 82 |
restored_img = (restored_img * 255.0).round().astype(np.uint8) # float32 to uint8
|
| 83 |
-
return Image.fromarray(restored_img) #
|
| 84 |
-
|
| 85 |
|
| 86 |
|
| 87 |
title = "InstructIR ✏️🖼️ 🤗"
|
|
@@ -139,7 +138,7 @@ demo = gr.Interface(
|
|
| 139 |
gr.Image(type="pil", label="Input"),
|
| 140 |
gr.Text(label="Prompt")
|
| 141 |
],
|
| 142 |
-
outputs=
|
| 143 |
title=title,
|
| 144 |
description=description,
|
| 145 |
article=article,
|
|
|
|
| 7 |
import numpy as np
|
| 8 |
import yaml
|
| 9 |
from huggingface_hub import hf_hub_download
|
| 10 |
+
from gradio_imageslider import ImageSlider
|
| 11 |
|
| 12 |
## local code
|
| 13 |
from models import instructir
|
|
|
|
| 80 |
restored_img = np.clip(restored_img, 0. , 1.)
|
| 81 |
|
| 82 |
restored_img = (restored_img * 255.0).round().astype(np.uint8) # float32 to uint8
|
| 83 |
+
return (image, Image.fromarray(restored_img)) #Image.fromarray(restored_img)
|
|
|
|
| 84 |
|
| 85 |
|
| 86 |
title = "InstructIR ✏️🖼️ 🤗"
|
|
|
|
| 138 |
gr.Image(type="pil", label="Input"),
|
| 139 |
gr.Text(label="Prompt")
|
| 140 |
],
|
| 141 |
+
outputs=ImageSlider(label="Restorated Image", type="pil"),
|
| 142 |
title=title,
|
| 143 |
description=description,
|
| 144 |
article=article,
|