Spaces:
Runtime error
Runtime error
NimaBoscarino
commited on
Commit
•
b95b59c
1
Parent(s):
48dea0e
Small refactor with list + dict comprehension
Browse filesUse comprehensions instead of loops to be pythonic
app.py
CHANGED
@@ -13,10 +13,8 @@ def get_ECCV_spaces():
|
|
13 |
r = requests.get(path)
|
14 |
d = r.json()
|
15 |
spaces = [SpaceInfo(**x) for x in d]
|
16 |
-
|
17 |
-
for
|
18 |
-
if spaces[i].id.split('/')[0] == 'ECCV2022' and hasattr(spaces[i], 'likes') and spaces[i].id != 'ECCV2022/Leaderboard' and spaces[i].id != 'ECCV2022/README':
|
19 |
-
blocks_spaces[spaces[i].id]=spaces[i].likes
|
20 |
df = pd.DataFrame(
|
21 |
[{"Spaces_Name": Spaces, "likes": likes} for Spaces,likes in blocks_spaces.items()])
|
22 |
df = df.sort_values(by=['likes'],ascending=False)
|
|
|
13 |
r = requests.get(path)
|
14 |
d = r.json()
|
15 |
spaces = [SpaceInfo(**x) for x in d]
|
16 |
+
spaces = [x for x in spaces if x.id.startswith("ECCV2022") and hasattr(x, 'likes') and x.id != 'ECCV2022/Leaderboard' and x.id != 'ECCV2022/README']
|
17 |
+
blocks_spaces = {x.id: x.likes for x in spaces}
|
|
|
|
|
18 |
df = pd.DataFrame(
|
19 |
[{"Spaces_Name": Spaces, "likes": likes} for Spaces,likes in blocks_spaces.items()])
|
20 |
df = df.sort_values(by=['likes'],ascending=False)
|