File size: 1,032 Bytes
e51e8f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python

from __future__ import annotations

import gradio as gr
import pandas as pd

from demo_list import DemoList

TITLE = "# List of hysts' Spaces"

demo_list = DemoList()

COLUMN_NAMES = [
    'title',
    'arxiv',
    'likes',
    'tags',
    'last_modified',
    'created',
    'sdk',
    'sdk_version',
    'status',
    'hardware',
]
COLUMN_DATATYPES = [
    'markdown',
    'markdown',
    'markdown',
    'number',
    'str',
    'str',
    'str',
    'str',
    'str',
    'str',
    'str',
]
DEFAULT_COLUMNS = [
    'title',
    'arxiv',
    'likes',
    'tags',
    'status',
    'hardware',
]


def update_df() -> pd.DataFrame:
    demo_list.update_data()
    return demo_list.df


with gr.Blocks(css='style.css') as demo:
    gr.Markdown(TITLE)
    df = gr.Dataframe(value=demo_list.df,
                      datatype=COLUMN_DATATYPES,
                      type='pandas')
    refresh_button = gr.Button('Refresh')
    refresh_button.click(fn=update_df, outputs=df)
demo.queue(api_open=False).launch()