adt commited on
Commit
7ce559e
·
1 Parent(s): 39c67b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -20
app.py CHANGED
@@ -1,44 +1,62 @@
 
 
 
 
 
 
1
  import gradio as gr
2
  import pandas as pd
3
 
4
- # Assuming columns_to_click are the columns which contain URLs that you want to make clickable
5
- columns_to_click = ["Paper / Repo", "Playground"]
 
6
 
7
  def get_data():
8
- # Load the CSV file into a DataFrame
9
  df = pd.read_csv(
10
  "https://docs.google.com/spreadsheets/d/e/2PACX-1vSC40sszorOjHfozmNqJT9lFiJhG94u3fbr3Ss_7fzcU3xqqJQuW1Ie_SNcWEB-uIsBi9NBUK7-ddet/pub?output=csv",
11
  skiprows=1,
12
  )
13
 
14
- # Drop rows where the 'Model' column is NaN
15
- df.dropna(subset=['Model'], inplace=True)
16
 
17
- # Drop rows where the 'Parameters \n(B)' column is 'TBA'
18
- df = df[df["Parameters \n(B)"] != "TBA"]
 
 
 
 
 
 
 
19
 
20
- # Apply make_clickable_cell to the specified columns
 
 
 
 
 
 
 
 
21
  for col in columns_to_click:
22
  df[col] = df[col].apply(make_clickable_cell)
23
 
24
  return df
25
 
26
- def make_clickable_cell(cell):
27
- if pd.isnull(cell) or not isinstance(cell, str):
28
- return ""
29
- else:
30
- return f'<a target="_blank" href="{cell}">{cell}</a>'
31
 
32
- # Load the data to get the columns for setting up datatype
33
- dataframe = get_data()
34
- dtypes = ["str" if c not in columns_to_click else "html" for c in dataframe.columns]
 
 
 
 
 
 
35
 
36
- # Gradio app setup
37
  with gr.Blocks() as demo:
38
- # Markdown and DataFrame components
39
  gr.Markdown(title)
40
  gr.Markdown(description)
41
  gr.DataFrame(get_data, datatype=dtypes, every=60)
42
 
43
- # Launch the Gradio app
44
- demo.launch()
 
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
8
  import pandas as pd
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/models](https://lifearchitect.ai/models/).
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()