Spaces:
Runtime error
Runtime error
improved classify script
Browse files
classify
CHANGED
@@ -25,7 +25,7 @@ def main():
|
|
25 |
parser.add_argument('--cpu', action='store_true', help='run on cpu')
|
26 |
parser.add_argument('--batch', type=int, default=10000, help='batch size')
|
27 |
parser.add_argument('--move', type=float, help='move files with certainty above the threshold')
|
28 |
-
parser.add_argument('--workers', type=int, help='max number of data loader workers'
|
29 |
# parser.add_argument('--train', action='store_true', help='train the model')
|
30 |
# parser.add_argument('--watch', type=str, help='folder to watch for images to classify')
|
31 |
# parser.add_argument('--folder', type=str, default='.', help='folder with images to classify (or train)')
|
@@ -60,17 +60,6 @@ def main():
|
|
60 |
else:
|
61 |
predict_in_batches(learn)
|
62 |
|
63 |
-
|
64 |
-
#def debogrify_stdout():
|
65 |
-
# """ deal with some bogus output to stdout from pytorch or something """
|
66 |
-
# stdout_fd = sys.stdout.fileno()
|
67 |
-
# stderr_fd = sys.stderr.fileno()
|
68 |
-
# new_stdout_fd = os.dup(stdout_fd)
|
69 |
-
# os.dup2(stderr_fd, stdout_fd)
|
70 |
-
# out = os.fdopen(new_stdout_fd, "w")
|
71 |
-
# return out
|
72 |
-
|
73 |
-
|
74 |
def predict_one_at_time(learn):
|
75 |
for filename in sys.stdin:
|
76 |
filename = filename.rstrip()
|
|
|
25 |
parser.add_argument('--cpu', action='store_true', help='run on cpu')
|
26 |
parser.add_argument('--batch', type=int, default=10000, help='batch size')
|
27 |
parser.add_argument('--move', type=float, help='move files with certainty above the threshold')
|
28 |
+
parser.add_argument('--workers', type=int, default=nproc, help='max number of data loader workers')
|
29 |
# parser.add_argument('--train', action='store_true', help='train the model')
|
30 |
# parser.add_argument('--watch', type=str, help='folder to watch for images to classify')
|
31 |
# parser.add_argument('--folder', type=str, default='.', help='folder with images to classify (or train)')
|
|
|
60 |
else:
|
61 |
predict_in_batches(learn)
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
def predict_one_at_time(learn):
|
64 |
for filename in sys.stdin:
|
65 |
filename = filename.rstrip()
|