Enable Space to be updated every minute

#1
by lewtun HF staff - opened
Files changed (1) hide show
  1. app.py +32 -33
app.py CHANGED
@@ -1,7 +1,7 @@
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
2
 
3
  # %% auto 0
4
- __all__ = ['df', 'columns_to_click', 'title', 'description', 'dtypes', 'make_clickable_cell', 'value_func']
5
 
6
  # %% app.ipynb 0
7
  import gradio as gr
@@ -9,55 +9,54 @@ import pandas as pd
9
 
10
 
11
  # %% app.ipynb 1
12
- df = pd.read_csv(
13
- "https://docs.google.com/spreadsheets/d/e/2PACX-1vSC40sszorOjHfozmNqJT9lFiJhG94u3fbr3Ss_7fzcU3xqqJQuW1Ie_SNcWEB-uIsBi9NBUK7-ddet/pub?output=csv",
14
- skiprows=1,
15
- )
16
 
 
 
 
 
 
17
 
18
- # %% app.ipynb 2
19
- # Drop footers
20
- df = df.copy()[~df["Model"].isna()]
21
 
 
 
 
22
 
23
- # %% app.ipynb 3
24
- # Drop TBA models
25
- df = df.copy()[df["Parameters \n(B)"] != "TBA"]
26
 
 
 
 
27
 
28
- # %% app.ipynb 6
29
- def make_clickable_cell(cell):
30
- if pd.isnull(cell):
31
- return ""
32
- else:
33
- return f'<a target="_blank" href="{cell}">{cell}</a>'
34
 
 
 
 
 
 
 
35
 
36
- # %% app.ipynb 7
37
- columns_to_click = ["Paper / Repo", "Selected \nplaygrounds"]
38
- for col in columns_to_click:
39
- df[col] = df[col].apply(make_clickable_cell)
40
 
 
 
 
41
 
42
- # %% app.ipynb 9
43
- title = """<h1 align="center">The Large Language Models Landscape</h1>"""
44
- description = """Large Language Models (LLMs) today come in a variety architectures and capabilities. This interactive landscape provides a visual overview of the most important LLMs, including their training data, size, release date, and whether they are openly accessible or not. It also includes notes on each model to provide additional context. This landscape is derived from data compiled by Dr. Alan D. Thompson at [lifearchitect.ai/models](https://lifearchitect.ai/models/).
45
- """
46
 
47
 
48
- # %% app.ipynb 10
49
- dtypes = ["str" if c not in columns_to_click else "markdown" for c in df.columns]
 
 
50
 
51
 
52
- # %% app.ipynb 11
53
- def value_func():
54
- return df
55
 
56
 
 
57
  with gr.Blocks() as demo:
58
  gr.Markdown(title)
59
  gr.Markdown(description)
60
- gr.components.DataFrame(value=value_func, datatype=dtypes)
61
-
62
- demo.launch()
63
 
 
 
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
2
 
3
  # %% auto 0
4
+ __all__ = ['columns_to_click', 'title', 'description', 'dtypes', 'get_data']
5
 
6
  # %% app.ipynb 0
7
  import gradio as gr
 
9
 
10
 
11
  # %% app.ipynb 1
12
+ columns_to_click = ["Paper / Repo", "Selected \nplaygrounds"]
 
 
 
13
 
14
+ def get_data():
15
+ df = pd.read_csv(
16
+ "https://docs.google.com/spreadsheets/d/e/2PACX-1vSC40sszorOjHfozmNqJT9lFiJhG94u3fbr3Ss_7fzcU3xqqJQuW1Ie_SNcWEB-uIsBi9NBUK7-ddet/pub?output=csv",
17
+ skiprows=1,
18
+ )
19
 
 
 
 
20
 
21
+ # %% app.ipynb 2
22
+ # Drop footers
23
+ df = df.copy()[~df["Model"].isna()]
24
 
 
 
 
25
 
26
+ # %% app.ipynb 3
27
+ # Drop TBA models
28
+ df = df.copy()[df["Parameters \n(B)"] != "TBA"]
29
 
 
 
 
 
 
 
30
 
31
+ # %% app.ipynb 6
32
+ def make_clickable_cell(cell):
33
+ if pd.isnull(cell):
34
+ return ""
35
+ else:
36
+ return f'<a target="_blank" href="{cell}">{cell}</a>'
37
 
 
 
 
 
38
 
39
+ # %% app.ipynb 7
40
+ for col in columns_to_click:
41
+ df[col] = df[col].apply(make_clickable_cell)
42
 
43
+ return df
 
 
 
44
 
45
 
46
+ # %% app.ipynb 2
47
+ title = """<h1 align="center">The Large Language Models Landscape</h1>"""
48
+ description = """Large Language Models (LLMs) today come in a variety architectures and capabilities. This interactive landscape provides a visual overview of the most important LLMs, including their training data, size, release date, and whether they are openly accessible or not. It also includes notes on each model to provide additional context. This landscape is derived from data compiled by Dr. Alan D. Thompson at [lifearchitect.ai](https://lifearchitect.ai).
49
+ """
50
 
51
 
52
+ # %% app.ipynb 3
53
+ dtypes = ["str" if c not in columns_to_click else "markdown" for c in get_data().columns]
 
54
 
55
 
56
+ # %% app.ipynb 4
57
  with gr.Blocks() as demo:
58
  gr.Markdown(title)
59
  gr.Markdown(description)
60
+ gr.DataFrame(get_data, datatype=dtypes, every=60)
 
 
61
 
62
+ demo.queue().launch()