Update app.py
Browse files
app.py
CHANGED
|
@@ -73,13 +73,13 @@ def postprocess_image(tensor):
|
|
| 73 |
image = np.transpose(image, (1, 2, 0))
|
| 74 |
return (image * 255).astype(np.uint8)
|
| 75 |
|
| 76 |
-
def deblur_image(
|
| 77 |
-
if
|
| 78 |
return None
|
| 79 |
|
| 80 |
try:
|
| 81 |
-
# Load the image from the
|
| 82 |
-
input_image = Image.open(
|
| 83 |
|
| 84 |
# Save original size
|
| 85 |
original_size = input_image.size
|
|
@@ -139,10 +139,10 @@ body, .gradio-container {
|
|
| 139 |
}
|
| 140 |
"""
|
| 141 |
|
| 142 |
-
# ✅ Gradio interface using gr.File
|
| 143 |
demo = gr.Interface(
|
| 144 |
fn=deblur_image,
|
| 145 |
-
inputs=gr.File(label="Upload Blurry Image (No Preview)", type="
|
| 146 |
outputs=gr.Image(type="numpy", label="Deblurred Result"),
|
| 147 |
title="Image Deblurring",
|
| 148 |
description="Upload a blurry image and get it deblurred using deep learning.",
|
|
|
|
| 73 |
image = np.transpose(image, (1, 2, 0))
|
| 74 |
return (image * 255).astype(np.uint8)
|
| 75 |
|
| 76 |
+
def deblur_image(filepath):
|
| 77 |
+
if filepath is None:
|
| 78 |
return None
|
| 79 |
|
| 80 |
try:
|
| 81 |
+
# Load the image from the filepath
|
| 82 |
+
input_image = Image.open(filepath).convert("RGB")
|
| 83 |
|
| 84 |
# Save original size
|
| 85 |
original_size = input_image.size
|
|
|
|
| 139 |
}
|
| 140 |
"""
|
| 141 |
|
| 142 |
+
# ✅ Gradio interface using gr.File with correct type
|
| 143 |
demo = gr.Interface(
|
| 144 |
fn=deblur_image,
|
| 145 |
+
inputs=gr.File(label="Upload Blurry Image (No Preview)", type="filepath"),
|
| 146 |
outputs=gr.Image(type="numpy", label="Deblurred Result"),
|
| 147 |
title="Image Deblurring",
|
| 148 |
description="Upload a blurry image and get it deblurred using deep learning.",
|