pratyyush commited on
Commit
c7ffd84
·
verified ·
1 Parent(s): e17de0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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(file):
77
- if file is None:
78
  return None
79
 
80
  try:
81
- # Load the image from the uploaded file
82
- input_image = Image.open(file.name).convert("RGB")
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 (no preview) with custom CSS
143
  demo = gr.Interface(
144
  fn=deblur_image,
145
- inputs=gr.File(label="Upload Blurry Image (No Preview)", type="file"),
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.",