Update app.py
Browse files
app.py
CHANGED
|
@@ -116,6 +116,9 @@ def run_inference(temp_dir, removed_bg_path):
|
|
| 116 |
return f"Error during inference: {str(e)}"
|
| 117 |
|
| 118 |
def process_image(input_url):
|
|
|
|
|
|
|
|
|
|
| 119 |
# Remove background
|
| 120 |
result = remove_background(input_url)
|
| 121 |
|
|
@@ -134,6 +137,7 @@ def process_image(input_url):
|
|
| 134 |
|
| 135 |
shutil.rmtree(temp_dir) # Cleanup temporary folder
|
| 136 |
print(output_video)
|
|
|
|
| 137 |
return output_video[0]
|
| 138 |
|
| 139 |
def gradio_interface():
|
|
|
|
| 116 |
return f"Error during inference: {str(e)}"
|
| 117 |
|
| 118 |
def process_image(input_url):
|
| 119 |
+
|
| 120 |
+
torch.cuda.empty_cache()
|
| 121 |
+
|
| 122 |
# Remove background
|
| 123 |
result = remove_background(input_url)
|
| 124 |
|
|
|
|
| 137 |
|
| 138 |
shutil.rmtree(temp_dir) # Cleanup temporary folder
|
| 139 |
print(output_video)
|
| 140 |
+
torch.cuda.empty_cache()
|
| 141 |
return output_video[0]
|
| 142 |
|
| 143 |
def gradio_interface():
|