Janeka commited on
Commit
e20b9fd
·
verified ·
1 Parent(s): ae93999

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -1,9 +1,17 @@
 
1
  import gradio as gr
2
  from rembg import remove
3
 
 
 
 
4
  def remove_background(input_image):
5
- output = remove(input_image)
6
- return output
 
 
 
 
7
 
8
  interface = gr.Interface(
9
  fn=remove_background,
 
1
+ import os
2
  import gradio as gr
3
  from rembg import remove
4
 
5
+ # Set environment variable for Numba
6
+ os.environ['NUMBA_CACHE_DIR'] = '/tmp/numba_cache'
7
+
8
  def remove_background(input_image):
9
+ try:
10
+ output = remove(input_image)
11
+ return output
12
+ except Exception as e:
13
+ print(f"Error processing image: {str(e)}")
14
+ return None
15
 
16
  interface = gr.Interface(
17
  fn=remove_background,