Spaces:
Runtime error
Runtime error
Commit
·
52a435b
1
Parent(s):
a4a37cc
leaderboard
Browse files
app.py
CHANGED
@@ -2,23 +2,24 @@ import gradio as gr
|
|
2 |
from huggingface_hub import list_spaces
|
3 |
from cachetools import TTLCache, cached
|
4 |
from toolz import groupby, valmap
|
5 |
-
from diskcache import Cache
|
6 |
-
import platform
|
7 |
|
8 |
-
is_macos = platform.system() == "Darwin"
|
9 |
|
10 |
-
if is_macos:
|
11 |
-
|
12 |
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
else:
|
17 |
-
|
18 |
-
|
19 |
|
20 |
|
21 |
-
@cached_decorator
|
|
|
22 |
def get_spaces():
|
23 |
return list(list_spaces(full=True))
|
24 |
|
@@ -139,6 +140,7 @@ with gr.Blocks() as demo:
|
|
139 |
value="yes",
|
140 |
)
|
141 |
run_btn = gr.Button("Show ranking for this Space org org/user!", label="Rank Space")
|
|
|
142 |
result = gr.Markdown()
|
143 |
run_btn.click(rank_space_and_org, inputs=[space_id, filter_zero], outputs=result)
|
144 |
gr.Markdown("## Leaderboard of Top 100 Spaces and Orgs/Users by Likes")
|
|
|
2 |
from huggingface_hub import list_spaces
|
3 |
from cachetools import TTLCache, cached
|
4 |
from toolz import groupby, valmap
|
5 |
+
# from diskcache import Cache
|
6 |
+
# import platform
|
7 |
|
8 |
+
# is_macos = platform.system() == "Darwin"
|
9 |
|
10 |
+
# if is_macos:
|
11 |
+
# cache = Cache("cache")
|
12 |
|
13 |
+
# def cached_decorator(func):
|
14 |
+
# return cache.memoize(typed=True, expire=1)(func)
|
15 |
|
16 |
+
# else:
|
17 |
+
# ttl_cache = TTLCache(maxsize=100, ttl=60 * 10)
|
18 |
+
# cached_decorator = cached(cache=ttl_cache)
|
19 |
|
20 |
|
21 |
+
# @cached_decorator
|
22 |
+
@cached(cache=TTLCache(maxsize=100, ttl=60 * 10))
|
23 |
def get_spaces():
|
24 |
return list(list_spaces(full=True))
|
25 |
|
|
|
140 |
value="yes",
|
141 |
)
|
142 |
run_btn = gr.Button("Show ranking for this Space org org/user!", label="Rank Space")
|
143 |
+
gr.Markdown("### Ranking for org/user or space")
|
144 |
result = gr.Markdown()
|
145 |
run_btn.click(rank_space_and_org, inputs=[space_id, filter_zero], outputs=result)
|
146 |
gr.Markdown("## Leaderboard of Top 100 Spaces and Orgs/Users by Likes")
|