Update script.py
Browse filesadding test to make sure network access is blocked
script.py
CHANGED
|
@@ -23,7 +23,15 @@ from preprocess import preprocess
|
|
| 23 |
DATASET_PATH = "/tmp/data"
|
| 24 |
dataset_remote = load_dataset(DATASET_PATH,split = "test",streaming = True)
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
# load your model
|
| 28 |
device = "cuda:0"
|
| 29 |
model = Model().to(device)
|
|
|
|
| 23 |
DATASET_PATH = "/tmp/data"
|
| 24 |
dataset_remote = load_dataset(DATASET_PATH,split = "test",streaming = True)
|
| 25 |
|
| 26 |
+
# this should fail since there is not network access during model run
|
| 27 |
+
try:
|
| 28 |
+
import requests
|
| 29 |
+
r = requests.get("https://stresearch.github.io/SAFE/logo.jpg")
|
| 30 |
+
print(r.text)
|
| 31 |
+
except Exception as e:
|
| 32 |
+
print("download test faild as expected")
|
| 33 |
+
print(e)
|
| 34 |
+
|
| 35 |
# load your model
|
| 36 |
device = "cuda:0"
|
| 37 |
model = Model().to(device)
|