Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
@@ -60,54 +60,25 @@ except FileNotFoundError:
|
|
60 |
except Exception as e:
|
61 |
print(f"An error occurred: {e}")
|
62 |
|
63 |
-
print("Contents of the directory:", os.listdir("./"))
|
64 |
-
|
65 |
-
# Show the content of data folder as a tree
|
66 |
-
print("Contents of the data folder:")
|
67 |
-
for root, dirs, files in os.walk("./dogs"):
|
68 |
-
level = root.replace("./data", "").count(os.sep)
|
69 |
-
indent = " " * 4 * (level)
|
70 |
-
print(f"{indent}{os.path.basename(root)}/")
|
71 |
-
subindent = " " * 4 * (level + 1)
|
72 |
-
for f in files:
|
73 |
-
# ignore .jpeg files
|
74 |
-
if not f.endswith(".jpeg"):
|
75 |
-
print(f"{subindent}{f}")
|
76 |
-
|
77 |
-
|
78 |
|
79 |
NUMBER_OF_IMAGES = 30
|
80 |
intro_screen = Image.open("./images/intro.jpg")
|
81 |
|
82 |
-
# chec kif the metadata is present
|
83 |
-
if not os.path.exists("./dogs/top1/metadata.json"):
|
84 |
-
print("metadata.json is not present")
|
85 |
-
# show the content of dogs and top1
|
86 |
-
print("Contents of the dogs folder:")
|
87 |
-
for root, dirs, files in os.walk("./dogs"):
|
88 |
-
level = root.replace("./dogs", "").count(os.sep)
|
89 |
-
indent = " " * 4 * (level)
|
90 |
-
print(f"{indent}{os.path.basename(root)}/")
|
91 |
-
subindent = " " * 4 * (level + 1)
|
92 |
-
for f in files:
|
93 |
-
print(f"{subindent}{f}")
|
94 |
-
else:
|
95 |
-
print("metadata.json is present")
|
96 |
|
97 |
meta_top1 = json.load(open("./dogs/top1/metadata.json"))
|
98 |
-
|
99 |
|
100 |
all_data = {}
|
101 |
all_data["top1"] = meta_top1
|
102 |
-
all_data["
|
103 |
|
104 |
|
105 |
-
# for data in all_data["top1"] and all_data["
|
106 |
for k in all_data["top1"].keys():
|
107 |
all_data["top1"][k]["type"] = "top1"
|
108 |
|
109 |
-
for k in all_data["
|
110 |
-
all_data["
|
111 |
|
112 |
|
113 |
REPO_URL = "taesiri/AdvisingNetworksReviewDataExtension"
|
|
|
60 |
except Exception as e:
|
61 |
print(f"An error occurred: {e}")
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
NUMBER_OF_IMAGES = 30
|
65 |
intro_screen = Image.open("./images/intro.jpg")
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
meta_top1 = json.load(open("./dogs/top1/metadata.json"))
|
69 |
+
meta_topk = json.load(open("./dogs/topk/metadata.json"))
|
70 |
|
71 |
all_data = {}
|
72 |
all_data["top1"] = meta_top1
|
73 |
+
all_data["topk"] = meta_topk
|
74 |
|
75 |
|
76 |
+
# for data in all_data["top1"] and all_data["topk"] add a key to show which type they are
|
77 |
for k in all_data["top1"].keys():
|
78 |
all_data["top1"][k]["type"] = "top1"
|
79 |
|
80 |
+
for k in all_data["topk"].keys():
|
81 |
+
all_data["topk"][k]["type"] = "topk"
|
82 |
|
83 |
|
84 |
REPO_URL = "taesiri/AdvisingNetworksReviewDataExtension"
|