Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,18 @@
|
|
| 1 |
-
from fastapi import FastAPI, UploadFile, File, Header, HTTPException
|
| 2 |
-
from fastapi.responses import JSONResponse
|
| 3 |
-
from PIL import Image
|
| 4 |
-
import numpy as np
|
| 5 |
-
import tensorflow as tf
|
| 6 |
-
import torch
|
| 7 |
-
import io
|
| 8 |
-
import cv2
|
| 9 |
import os
|
| 10 |
-
import numpy as np
|
| 11 |
import random
|
|
|
|
| 12 |
import tensorflow as tf
|
|
|
|
| 13 |
|
| 14 |
-
|
|
|
|
| 15 |
random.seed(0)
|
| 16 |
np.random.seed(0)
|
| 17 |
tf.random.set_seed(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
from segment_anything import sam_model_registry, SamPredictor
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
|
|
|
| 2 |
import random
|
| 3 |
+
import numpy as np
|
| 4 |
import tensorflow as tf
|
| 5 |
+
import torch
|
| 6 |
|
| 7 |
+
# Force deterministic & no random_device
|
| 8 |
+
os.environ["PYTHONHASHSEED"] = "0"
|
| 9 |
random.seed(0)
|
| 10 |
np.random.seed(0)
|
| 11 |
tf.random.set_seed(0)
|
| 12 |
+
torch.manual_seed(0)
|
| 13 |
+
torch.use_deterministic_algorithms(True)
|
| 14 |
+
torch.set_deterministic_debug_mode("warn")
|
| 15 |
+
|
| 16 |
|
| 17 |
from segment_anything import sam_model_registry, SamPredictor
|
| 18 |
|