Spaces:
Runtime error
Runtime error
adding webhooks tab and also renaming to coming soon tab
Browse files- __pycache__/app.cpython-310.pyc +0 -0
- app.py +34 -5
__pycache__/app.cpython-310.pyc
CHANGED
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
|
|
app.py
CHANGED
@@ -14,18 +14,28 @@ class News:
|
|
14 |
self.link = link
|
15 |
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
class Category:
|
18 |
-
def __init__(self, title, description, news: List[News] = None, spaces=None):
|
19 |
if news is None:
|
20 |
news = []
|
21 |
|
22 |
if spaces is None:
|
23 |
spaces = []
|
24 |
|
|
|
|
|
|
|
25 |
self.title = title
|
26 |
self.description = description
|
27 |
self.news = news
|
28 |
self.spaces = spaces
|
|
|
29 |
|
30 |
|
31 |
inclusive = Category(
|
@@ -110,6 +120,16 @@ rigorous = Category(
|
|
110 |
title="Disaggregators",
|
111 |
id="society-ethics/disaggregators"
|
112 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
]
|
114 |
)
|
115 |
socially_conscious = Category(
|
@@ -290,6 +310,13 @@ def space_card(space):
|
|
290 |
button = gr.Button(elem_id="article-button", value="View π")
|
291 |
button.click(fn=None, _js=f"() => window.open('https://hf.space/{space.id}')")
|
292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
|
294 |
def category_tab(category):
|
295 |
with gr.Tab(label=category.title, elem_id="news-tab"):
|
@@ -304,10 +331,12 @@ def category_tab(category):
|
|
304 |
with gr.Tab(label="Spaces"):
|
305 |
with gr.Row(elem_id="spaces-flex"):
|
306 |
[space_card(x) for x in category.spaces]
|
307 |
-
with gr.Tab(label="
|
308 |
-
gr.Markdown(elem_id="margin-top", value="#### Check
|
309 |
-
|
310 |
-
|
|
|
|
|
311 |
|
312 |
|
313 |
with gr.Blocks(css="#margin-top {margin-top: 15px} #center {text-align: center;} #news-tab {padding: 15px;} #news-tab h3 {margin: 0px; text-align: center;} #news-tab p {margin: 0px;} #article-button {flex-grow: initial;} #news-row {align-items: center;} #spaces-flex {flex-wrap: wrap;} #space-card { display: flex; min-width: calc(90% / 3); max-width:calc(100% / 3); box-sizing: border-box;}") as demo:
|
|
|
14 |
self.link = link
|
15 |
|
16 |
|
17 |
+
class Webhook:
|
18 |
+
def __init__(self, title, id):
|
19 |
+
self.title = title
|
20 |
+
self.id = id
|
21 |
+
|
22 |
+
|
23 |
class Category:
|
24 |
+
def __init__(self, title, description, news: List[News] = None, spaces=None, webhooks = None):
|
25 |
if news is None:
|
26 |
news = []
|
27 |
|
28 |
if spaces is None:
|
29 |
spaces = []
|
30 |
|
31 |
+
if webhooks is None:
|
32 |
+
webhooks = []
|
33 |
+
|
34 |
self.title = title
|
35 |
self.description = description
|
36 |
self.news = news
|
37 |
self.spaces = spaces
|
38 |
+
self.webhooks = webhooks
|
39 |
|
40 |
|
41 |
inclusive = Category(
|
|
|
120 |
title="Disaggregators",
|
121 |
id="society-ethics/disaggregators"
|
122 |
)
|
123 |
+
],
|
124 |
+
webhooks=[
|
125 |
+
Webhook(
|
126 |
+
title = "Librarian Bot",
|
127 |
+
id = "librarian-bot"
|
128 |
+
),
|
129 |
+
Webhook(
|
130 |
+
title = "Auto Re-Train",
|
131 |
+
id = "spaces/webhooks-explorers/auto-retrain-argilla"
|
132 |
+
)
|
133 |
]
|
134 |
)
|
135 |
socially_conscious = Category(
|
|
|
310 |
button = gr.Button(elem_id="article-button", value="View π")
|
311 |
button.click(fn=None, _js=f"() => window.open('https://hf.space/{space.id}')")
|
312 |
|
313 |
+
def webhook_card(webhook):
|
314 |
+
with gr.Box(elm_id = "webhook-card"):
|
315 |
+
with gr.Row(elem_id = "news-row"):
|
316 |
+
gr.Markdown(f"{webhook.title}")
|
317 |
+
button = gr.Button(elem_id="article-button", value="View π€ ")
|
318 |
+
button.click(fn=None, _js=f"() => window.open('https://huggingface.co/{webhook.id}')") ### to-do --> change to bot HF account page
|
319 |
+
|
320 |
|
321 |
def category_tab(category):
|
322 |
with gr.Tab(label=category.title, elem_id="news-tab"):
|
|
|
331 |
with gr.Tab(label="Spaces"):
|
332 |
with gr.Row(elem_id="spaces-flex"):
|
333 |
[space_card(x) for x in category.spaces]
|
334 |
+
with gr.Tab(label="Webhooks"):
|
335 |
+
gr.Markdown(elem_id="margin-top", value="#### Check out our [webhooks guide](https://huggingface.co/docs/hub/webhooks) to create your own")
|
336 |
+
with gr.Row(elem_id="webhooks-flex"):
|
337 |
+
[webhook_card(x) for x in category.webhooks]
|
338 |
+
with gr.Tab(label="Coming Soon!"):
|
339 |
+
gr.Markdown(elem_id="margin-top", value="#### Check back soon for featured Models and Datasets π€")
|
340 |
|
341 |
|
342 |
with gr.Blocks(css="#margin-top {margin-top: 15px} #center {text-align: center;} #news-tab {padding: 15px;} #news-tab h3 {margin: 0px; text-align: center;} #news-tab p {margin: 0px;} #article-button {flex-grow: initial;} #news-row {align-items: center;} #spaces-flex {flex-wrap: wrap;} #space-card { display: flex; min-width: calc(90% / 3); max-width:calc(100% / 3); box-sizing: border-box;}") as demo:
|