Spaces:
Build error
Build error
static folder creation line added
Browse files- preprocess.py +2 -1
preprocess.py
CHANGED
|
@@ -34,6 +34,7 @@ def save_output(image_name, output_name, pred, d_dir, type):
|
|
| 34 |
|
| 35 |
# Remove Background From Image (Generate Mask, and Final Results)
|
| 36 |
def removeBg(imagePath):
|
|
|
|
| 37 |
inputs_dir = os.path.join(currentDir, 'static/inputs/')
|
| 38 |
results_dir = os.path.join(currentDir, 'static/results/')
|
| 39 |
masks_dir = os.path.join(currentDir, 'static/masks/')
|
|
@@ -86,7 +87,7 @@ def removeBg(imagePath):
|
|
| 86 |
net.load_state_dict(torch.load(model_dir, map_location='cpu'))
|
| 87 |
# ------- Load Trained Model --------
|
| 88 |
print("---Removing Background...")
|
| 89 |
-
|
| 90 |
d1, d2, d3, d4, d5, d6, d7 = net(image)
|
| 91 |
pred = d1[:, 0, :, :]
|
| 92 |
ma = torch.max(pred)
|
|
|
|
| 34 |
|
| 35 |
# Remove Background From Image (Generate Mask, and Final Results)
|
| 36 |
def removeBg(imagePath):
|
| 37 |
+
os.mkdir('static')
|
| 38 |
inputs_dir = os.path.join(currentDir, 'static/inputs/')
|
| 39 |
results_dir = os.path.join(currentDir, 'static/results/')
|
| 40 |
masks_dir = os.path.join(currentDir, 'static/masks/')
|
|
|
|
| 87 |
net.load_state_dict(torch.load(model_dir, map_location='cpu'))
|
| 88 |
# ------- Load Trained Model --------
|
| 89 |
print("---Removing Background...")
|
| 90 |
+
|
| 91 |
d1, d2, d3, d4, d5, d6, d7 = net(image)
|
| 92 |
pred = d1[:, 0, :, :]
|
| 93 |
ma = torch.max(pred)
|