Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -44,28 +44,23 @@ def parse_args() -> argparse.Namespace:
|
|
44 |
def load_sample_image_paths() -> list[pathlib.Path]:
|
45 |
image_dir = pathlib.Path('images')
|
46 |
if not image_dir.exists():
|
47 |
-
dataset_repo = '
|
48 |
path = huggingface_hub.hf_hub_download(dataset_repo,
|
49 |
-
'
|
50 |
-
repo_type='dataset'
|
51 |
-
use_auth_token=TOKEN)
|
52 |
with tarfile.open(path) as f:
|
53 |
f.extractall()
|
54 |
return sorted(image_dir.glob('*'))
|
55 |
|
56 |
|
57 |
def load_model() -> tf.keras.Model:
|
58 |
-
path =
|
59 |
-
MODEL_FILENAME,
|
60 |
-
use_auth_token=TOKEN)
|
61 |
model = tf.keras.models.load_model(path)
|
62 |
return model
|
63 |
|
64 |
|
65 |
def load_labels() -> list[str]:
|
66 |
-
path =
|
67 |
-
LABEL_FILENAME,
|
68 |
-
use_auth_token=TOKEN)
|
69 |
with open(path) as f:
|
70 |
labels = [line.strip() for line in f.readlines()]
|
71 |
return labels
|
|
|
44 |
def load_sample_image_paths() -> list[pathlib.Path]:
|
45 |
image_dir = pathlib.Path('images')
|
46 |
if not image_dir.exists():
|
47 |
+
dataset_repo = 'hhysts/TADNE-sample-images'
|
48 |
path = huggingface_hub.hf_hub_download(dataset_repo,
|
49 |
+
'512/0-99999.tar',
|
50 |
+
repo_type='dataset')
|
|
|
51 |
with tarfile.open(path) as f:
|
52 |
f.extractall()
|
53 |
return sorted(image_dir.glob('*'))
|
54 |
|
55 |
|
56 |
def load_model() -> tf.keras.Model:
|
57 |
+
path = pathlib.Path('model-resnet_custom_v3.h5')
|
|
|
|
|
58 |
model = tf.keras.models.load_model(path)
|
59 |
return model
|
60 |
|
61 |
|
62 |
def load_labels() -> list[str]:
|
63 |
+
path = pathlib.Path('tags.txt')
|
|
|
|
|
64 |
with open(path) as f:
|
65 |
labels = [line.strip() for line in f.readlines()]
|
66 |
return labels
|