Janeka commited on
Commit
12c1ac0
·
verified ·
1 Parent(s): ee349e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -22,16 +22,16 @@ def remove_bg(image):
22
  except Exception as e:
23
  raise gr.Error(f"Error processing image: {str(e)}")
24
 
25
- # Define the interface with explicit API enabled
26
  iface = gr.Interface(
27
  fn=remove_bg,
28
  inputs=gr.Image(type="filepath", label="Input Image"),
29
  outputs=gr.Image(label="Output Image", type="pil"),
30
  title="Background Remover",
31
  description="Upload an image to remove its background",
32
- allow_flagging="never" # Disable the flagging feature
33
  )
34
 
35
- # Launch the app with API enabled
36
  if __name__ == "__main__":
37
- iface.launch(server_name="0.0.0.0", server_port=7860, enable_api=True)
 
22
  except Exception as e:
23
  raise gr.Error(f"Error processing image: {str(e)}")
24
 
25
+ # Create interface with correct flagging mode
26
  iface = gr.Interface(
27
  fn=remove_bg,
28
  inputs=gr.Image(type="filepath", label="Input Image"),
29
  outputs=gr.Image(label="Output Image", type="pil"),
30
  title="Background Remover",
31
  description="Upload an image to remove its background",
32
+ flagging_mode="never" # Correct way to disable flagging
33
  )
34
 
35
+ # Launch the app (API is automatically enabled in newer Gradio versions)
36
  if __name__ == "__main__":
37
+ iface.launch(server_name="0.0.0.0", server_port=7860)