aryrk commited on
Commit
ec61f43
·
1 Parent(s): 7ba731c
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -39,6 +39,11 @@ def clear_session_files(session_id):
39
  shutil.rmtree(session_dir)
40
 
41
  def reflection_removal(input_image, preprocess_type="resize_and_crop"):
 
 
 
 
 
42
 
43
  session_id = generate_session_id()
44
  session_dir = os.path.join(UPLOAD_DIR, session_id)
@@ -119,12 +124,12 @@ preprocess_options = [
119
 
120
  iface = gr.Interface(
121
  fn=reflection_removal,
122
- inputs=[
123
  gr.Image(type="filepath", label="Upload Image (JPG/PNG)"),
124
  gr.Dropdown(choices=preprocess_options, label="Preprocessing Type", value="resize_and_crop")
125
  ],
126
  outputs=gr.Image(label="Result after Reflection Removal"),
127
- examples=[
128
  [os.path.join(SAMPLE_DIR, img), "resize_and_crop"]
129
  for img in sample_images
130
  ],
 
39
  shutil.rmtree(session_dir)
40
 
41
  def reflection_removal(input_image, preprocess_type="resize_and_crop"):
42
+ if preprocess_type not in ["resize_and_crop", "crop", "scale_width", "scale_width_and_crop", "none"]:
43
+ return "Invalid preprocessing type selected. Please choose a valid option."
44
+
45
+ print("Preprocessing Type:", preprocess_type)
46
+ print("Input Image:", input_image)
47
 
48
  session_id = generate_session_id()
49
  session_dir = os.path.join(UPLOAD_DIR, session_id)
 
124
 
125
  iface = gr.Interface(
126
  fn=reflection_removal,
127
+ inputs=[
128
  gr.Image(type="filepath", label="Upload Image (JPG/PNG)"),
129
  gr.Dropdown(choices=preprocess_options, label="Preprocessing Type", value="resize_and_crop")
130
  ],
131
  outputs=gr.Image(label="Result after Reflection Removal"),
132
+ examples=[
133
  [os.path.join(SAMPLE_DIR, img), "resize_and_crop"]
134
  for img in sample_images
135
  ],