Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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,
|