Spaces:
Sleeping
Sleeping
suvadityamuk
commited on
Commit
·
e6983ae
1
Parent(s):
fd4e202
removed interpretability option
Browse filesSigned-off-by: Suvaditya Mukherjee <suvadityamuk@gmail.com>
app.py
CHANGED
@@ -18,7 +18,7 @@ def calc_embeddings(all_files, names):
|
|
18 |
total = 0
|
19 |
for file in all_files:
|
20 |
name = names[total]
|
21 |
-
path = os.path.join(os.getcwd(),
|
22 |
# f = open(f"/celeb_dataset/'{name}'/{file}", "rb")
|
23 |
f = open(path, "rb")
|
24 |
file_bytes = np.asarray(bytearray(f.read()), dtype=np.uint8)
|
@@ -90,7 +90,7 @@ def run_inference(myImage):
|
|
90 |
continue
|
91 |
name = celeb
|
92 |
celebs.append(name)
|
93 |
-
for file in os.listdir(os.path.join(os.getcwd(),
|
94 |
files.append(file)
|
95 |
names.append(name)
|
96 |
embeddings, names = calc_embeddings(files, names)
|
@@ -132,7 +132,7 @@ def run_inference(myImage):
|
|
132 |
name = le.classes_[j]
|
133 |
text = "{}: {:.2f}%".format(name, proba * 100)
|
134 |
scores[name] = proba
|
135 |
-
if len(scores)>1:
|
136 |
del scores["Unknown"]
|
137 |
return scores
|
138 |
|
@@ -142,7 +142,6 @@ iface = gr.Interface(
|
|
142 |
inputs="image",
|
143 |
outputs="label",
|
144 |
live=True,
|
145 |
-
interpretation="default",
|
146 |
title="Who do you look Like?!",
|
147 |
)
|
148 |
iface.launch()
|
|
|
18 |
total = 0
|
19 |
for file in all_files:
|
20 |
name = names[total]
|
21 |
+
path = os.path.join(os.getcwd(), "celeb_dataset", name, file)
|
22 |
# f = open(f"/celeb_dataset/'{name}'/{file}", "rb")
|
23 |
f = open(path, "rb")
|
24 |
file_bytes = np.asarray(bytearray(f.read()), dtype=np.uint8)
|
|
|
90 |
continue
|
91 |
name = celeb
|
92 |
celebs.append(name)
|
93 |
+
for file in os.listdir(os.path.join(os.getcwd(), "celeb_dataset", celeb)):
|
94 |
files.append(file)
|
95 |
names.append(name)
|
96 |
embeddings, names = calc_embeddings(files, names)
|
|
|
132 |
name = le.classes_[j]
|
133 |
text = "{}: {:.2f}%".format(name, proba * 100)
|
134 |
scores[name] = proba
|
135 |
+
if len(scores) > 1:
|
136 |
del scores["Unknown"]
|
137 |
return scores
|
138 |
|
|
|
142 |
inputs="image",
|
143 |
outputs="label",
|
144 |
live=True,
|
|
|
145 |
title="Who do you look Like?!",
|
146 |
)
|
147 |
iface.launch()
|