hysts HF staff commited on
Commit
8235d81
1 Parent(s): aac19dd
Files changed (7) hide show
  1. .pre-commit-config.yaml +59 -35
  2. .style.yapf +0 -5
  3. README.md +1 -1
  4. app.py +16 -16
  5. paper_list.py +42 -44
  6. requirements.txt +1 -1
  7. style.css +1 -4
.pre-commit-config.yaml CHANGED
@@ -1,36 +1,60 @@
1
  repos:
2
- - repo: https://github.com/pre-commit/pre-commit-hooks
3
- rev: v4.2.0
4
- hooks:
5
- - id: check-executables-have-shebangs
6
- - id: check-json
7
- - id: check-merge-conflict
8
- - id: check-shebang-scripts-are-executable
9
- - id: check-toml
10
- - id: check-yaml
11
- - id: double-quote-string-fixer
12
- - id: end-of-file-fixer
13
- - id: mixed-line-ending
14
- args: ['--fix=lf']
15
- - id: requirements-txt-fixer
16
- - id: trailing-whitespace
17
- - repo: https://github.com/myint/docformatter
18
- rev: v1.4
19
- hooks:
20
- - id: docformatter
21
- args: ['--in-place']
22
- - repo: https://github.com/pycqa/isort
23
- rev: 5.12.0
24
- hooks:
25
- - id: isort
26
- - repo: https://github.com/pre-commit/mirrors-mypy
27
- rev: v0.991
28
- hooks:
29
- - id: mypy
30
- args: ['--ignore-missing-imports']
31
- additional_dependencies: ['types-python-slugify']
32
- - repo: https://github.com/google/yapf
33
- rev: v0.32.0
34
- hooks:
35
- - id: yapf
36
- args: ['--parallel', '--in-place']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.6.0
4
+ hooks:
5
+ - id: check-executables-have-shebangs
6
+ - id: check-json
7
+ - id: check-merge-conflict
8
+ - id: check-shebang-scripts-are-executable
9
+ - id: check-toml
10
+ - id: check-yaml
11
+ - id: end-of-file-fixer
12
+ - id: mixed-line-ending
13
+ args: ["--fix=lf"]
14
+ - id: requirements-txt-fixer
15
+ - id: trailing-whitespace
16
+ - repo: https://github.com/myint/docformatter
17
+ rev: v1.7.5
18
+ hooks:
19
+ - id: docformatter
20
+ args: ["--in-place"]
21
+ - repo: https://github.com/pycqa/isort
22
+ rev: 5.13.2
23
+ hooks:
24
+ - id: isort
25
+ args: ["--profile", "black"]
26
+ - repo: https://github.com/pre-commit/mirrors-mypy
27
+ rev: v1.10.0
28
+ hooks:
29
+ - id: mypy
30
+ args: ["--ignore-missing-imports"]
31
+ additional_dependencies:
32
+ [
33
+ "types-python-slugify",
34
+ "types-requests",
35
+ "types-PyYAML",
36
+ "types-pytz",
37
+ ]
38
+ - repo: https://github.com/psf/black
39
+ rev: 24.4.2
40
+ hooks:
41
+ - id: black
42
+ language_version: python3.10
43
+ args: ["--line-length", "119"]
44
+ - repo: https://github.com/kynan/nbstripout
45
+ rev: 0.7.1
46
+ hooks:
47
+ - id: nbstripout
48
+ args:
49
+ [
50
+ "--extra-keys",
51
+ "metadata.interpreter metadata.kernelspec cell.metadata.pycharm",
52
+ ]
53
+ - repo: https://github.com/nbQA-dev/nbQA
54
+ rev: 1.8.5
55
+ hooks:
56
+ - id: nbqa-black
57
+ - id: nbqa-pyupgrade
58
+ args: ["--py37-plus"]
59
+ - id: nbqa-isort
60
+ args: ["--float-to-top"]
.style.yapf DELETED
@@ -1,5 +0,0 @@
1
- [style]
2
- based_on_style = pep8
3
- blank_line_before_nested_class_or_def = false
4
- spaces_before_comment = 2
5
- split_before_logical_operator = true
 
 
 
 
 
 
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🦀
4
  colorFrom: green
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 3.39.0
8
  app_file: app.py
9
  pinned: true
10
  duplicated_from: ICML2022/ICML2022_papers
 
4
  colorFrom: green
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 4.36.1
8
  app_file: app.py
9
  pinned: true
10
  duplicated_from: ICML2022/ICML2022_papers
app.py CHANGED
@@ -6,30 +6,30 @@ import gradio as gr
6
 
7
  from paper_list import PaperList
8
 
9
- DESCRIPTION = '# ICML 2023 Papers'
10
 
11
  paper_list = PaperList()
12
 
13
- with gr.Blocks(css='style.css') as demo:
14
  gr.Markdown(DESCRIPTION)
15
 
16
  search_box = gr.Textbox(
17
- label='Search Title',
18
- placeholder=
19
- 'You can search for titles with regular expressions. e.g. (?<!sur)face'
20
  )
21
- case_sensitive = gr.Checkbox(label='Case Sensitive')
22
- filter_names = gr.CheckboxGroup(choices=[
23
- 'arXiv',
24
- 'GitHub',
25
- 'Space',
26
- 'Model',
27
- 'Dataset',
28
- ],
29
- label='Filter')
30
- search_button = gr.Button('Search')
 
 
31
 
32
- number_of_papers = gr.Textbox(label='Number of Papers Found')
33
  table = gr.HTML(show_label=False)
34
 
35
  demo.load(
 
6
 
7
  from paper_list import PaperList
8
 
9
+ DESCRIPTION = "# ICML 2023 Papers"
10
 
11
  paper_list = PaperList()
12
 
13
+ with gr.Blocks(css="style.css") as demo:
14
  gr.Markdown(DESCRIPTION)
15
 
16
  search_box = gr.Textbox(
17
+ label="Search Title", placeholder="You can search for titles with regular expressions. e.g. (?<!sur)face"
 
 
18
  )
19
+ case_sensitive = gr.Checkbox(label="Case Sensitive")
20
+ filter_names = gr.CheckboxGroup(
21
+ choices=[
22
+ "arXiv",
23
+ "GitHub",
24
+ "Space",
25
+ "Model",
26
+ "Dataset",
27
+ ],
28
+ label="Filter",
29
+ )
30
+ search_button = gr.Button("Search")
31
 
32
+ number_of_papers = gr.Textbox(label="Number of Papers Found")
33
  table = gr.HTML(show_label=False)
34
 
35
  demo.load(
paper_list.py CHANGED
@@ -6,11 +6,11 @@ import pandas as pd
6
 
7
  class PaperList:
8
  def __init__(self):
9
- self.organization_name = 'ICML2023'
10
- self.table = pd.read_csv('papers.csv')
11
  self._preprocess_table()
12
 
13
- self.table_header = '''
14
  <tr>
15
  <td width="38%">Title</td>
16
  <td width="25%">Authors</td>
@@ -21,33 +21,29 @@ class PaperList:
21
  <td width="5%">Models</td>
22
  <td width="5%">Datasets</td>
23
  <td width="5%">Claimed</td>
24
- </tr>'''
25
 
26
  def _preprocess_table(self) -> None:
27
- self.table['title_lowercase'] = self.table.title.str.lower()
28
 
29
  rows = []
30
  for row in self.table.itertuples():
31
- title = f'{row.title}'
32
- arxiv = f'<a href="{row.arxiv}" target="_blank">arXiv</a>' if isinstance(
33
- row.arxiv, str) else ''
34
- github = f'<a href="{row.github}" target="_blank">GitHub</a>' if isinstance(
35
- row.github, str) else ''
36
- hf_paper = f'<a href="{row.hf_paper}" target="_blank">Paper page</a>' if isinstance(
37
- row.hf_paper, str) else ''
38
- hf_space = f'<a href="{row.hf_space}" target="_blank">Space</a>' if isinstance(
39
- row.hf_space, str) else ''
40
- hf_model = f'<a href="{row.hf_model}" target="_blank">Model</a>' if isinstance(
41
- row.hf_model, str) else ''
42
- hf_dataset = f'<a href="{row.hf_dataset}" target="_blank">Dataset</a>' if isinstance(
43
- row.hf_dataset, str) else ''
44
- author_linked = '✅' if ~np.isnan(
45
- row.n_linked_authors) and row.n_linked_authors > 0 else ''
46
- n_linked_authors = '' if np.isnan(row.n_linked_authors) else int(
47
- row.n_linked_authors)
48
- n_authors = '' if np.isnan(row.n_authors) else int(row.n_authors)
49
- claimed_paper = '' if n_linked_authors == '' else f'{n_linked_authors}/{n_authors} {author_linked}'
50
- row = f'''
51
  <tr>
52
  <td>{title}</td>
53
  <td>{row.authors}</td>
@@ -58,33 +54,35 @@ class PaperList:
58
  <td>{hf_model}</td>
59
  <td>{hf_dataset}</td>
60
  <td>{claimed_paper}</td>
61
- </tr>'''
62
  rows.append(row)
63
- self.table['html_table_content'] = rows
64
 
65
- def render(self, search_query: str, case_sensitive: bool,
66
- filter_names: list[str]) -> tuple[str, str]:
67
  df = self.table
68
  if search_query:
69
  if case_sensitive:
70
  df = df[df.title.str.contains(search_query)]
71
  else:
72
  df = df[df.title_lowercase.str.contains(search_query.lower())]
73
- has_arxiv = 'arXiv' in filter_names
74
- has_github = 'GitHub' in filter_names
75
- has_hf_space = 'Space' in filter_names
76
- has_hf_model = 'Model' in filter_names
77
- has_hf_dataset = 'Dataset' in filter_names
78
- df = self.filter_table(df, has_arxiv, has_github, has_hf_space,
79
- has_hf_model, has_hf_dataset)
80
  n_claimed = len(df[df.n_linked_authors > 0])
81
- return f'{len(df)} ({n_claimed} claimed)', self.to_html(
82
- df, self.table_header)
83
 
84
  @staticmethod
85
- def filter_table(df: pd.DataFrame, has_arxiv: bool, has_github: bool,
86
- has_hf_space: bool, has_hf_model: bool,
87
- has_hf_dataset: bool) -> pd.DataFrame:
 
 
 
 
 
88
  if has_arxiv:
89
  df = df[~df.arxiv.isna()]
90
  if has_github:
@@ -99,10 +97,10 @@ class PaperList:
99
 
100
  @staticmethod
101
  def to_html(df: pd.DataFrame, table_header: str) -> str:
102
- table_data = ''.join(df.html_table_content)
103
- html = f'''
104
  <table>
105
  {table_header}
106
  {table_data}
107
- </table>'''
108
  return html
 
6
 
7
  class PaperList:
8
  def __init__(self):
9
+ self.organization_name = "ICML2023"
10
+ self.table = pd.read_csv("papers.csv")
11
  self._preprocess_table()
12
 
13
+ self.table_header = """
14
  <tr>
15
  <td width="38%">Title</td>
16
  <td width="25%">Authors</td>
 
21
  <td width="5%">Models</td>
22
  <td width="5%">Datasets</td>
23
  <td width="5%">Claimed</td>
24
+ </tr>"""
25
 
26
  def _preprocess_table(self) -> None:
27
+ self.table["title_lowercase"] = self.table.title.str.lower()
28
 
29
  rows = []
30
  for row in self.table.itertuples():
31
+ title = f"{row.title}"
32
+ arxiv = f'<a href="{row.arxiv}" target="_blank">arXiv</a>' if isinstance(row.arxiv, str) else ""
33
+ github = f'<a href="{row.github}" target="_blank">GitHub</a>' if isinstance(row.github, str) else ""
34
+ hf_paper = (
35
+ f'<a href="{row.hf_paper}" target="_blank">Paper page</a>' if isinstance(row.hf_paper, str) else ""
36
+ )
37
+ hf_space = f'<a href="{row.hf_space}" target="_blank">Space</a>' if isinstance(row.hf_space, str) else ""
38
+ hf_model = f'<a href="{row.hf_model}" target="_blank">Model</a>' if isinstance(row.hf_model, str) else ""
39
+ hf_dataset = (
40
+ f'<a href="{row.hf_dataset}" target="_blank">Dataset</a>' if isinstance(row.hf_dataset, str) else ""
41
+ )
42
+ author_linked = "✅" if ~np.isnan(row.n_linked_authors) and row.n_linked_authors > 0 else ""
43
+ n_linked_authors = "" if np.isnan(row.n_linked_authors) else int(row.n_linked_authors)
44
+ n_authors = "" if np.isnan(row.n_authors) else int(row.n_authors)
45
+ claimed_paper = "" if n_linked_authors == "" else f"{n_linked_authors}/{n_authors} {author_linked}"
46
+ row = f"""
 
 
 
 
47
  <tr>
48
  <td>{title}</td>
49
  <td>{row.authors}</td>
 
54
  <td>{hf_model}</td>
55
  <td>{hf_dataset}</td>
56
  <td>{claimed_paper}</td>
57
+ </tr>"""
58
  rows.append(row)
59
+ self.table["html_table_content"] = rows
60
 
61
+ def render(self, search_query: str, case_sensitive: bool, filter_names: list[str]) -> tuple[str, str]:
 
62
  df = self.table
63
  if search_query:
64
  if case_sensitive:
65
  df = df[df.title.str.contains(search_query)]
66
  else:
67
  df = df[df.title_lowercase.str.contains(search_query.lower())]
68
+ has_arxiv = "arXiv" in filter_names
69
+ has_github = "GitHub" in filter_names
70
+ has_hf_space = "Space" in filter_names
71
+ has_hf_model = "Model" in filter_names
72
+ has_hf_dataset = "Dataset" in filter_names
73
+ df = self.filter_table(df, has_arxiv, has_github, has_hf_space, has_hf_model, has_hf_dataset)
 
74
  n_claimed = len(df[df.n_linked_authors > 0])
75
+ return f"{len(df)} ({n_claimed} claimed)", self.to_html(df, self.table_header)
 
76
 
77
  @staticmethod
78
+ def filter_table(
79
+ df: pd.DataFrame,
80
+ has_arxiv: bool,
81
+ has_github: bool,
82
+ has_hf_space: bool,
83
+ has_hf_model: bool,
84
+ has_hf_dataset: bool,
85
+ ) -> pd.DataFrame:
86
  if has_arxiv:
87
  df = df[~df.arxiv.isna()]
88
  if has_github:
 
97
 
98
  @staticmethod
99
  def to_html(df: pd.DataFrame, table_header: str) -> str:
100
+ table_data = "".join(df.html_table_content)
101
+ html = f"""
102
  <table>
103
  {table_header}
104
  {table_data}
105
+ </table>"""
106
  return html
requirements.txt CHANGED
@@ -1 +1 @@
1
- pandas==2.0.3
 
1
+ pandas==2.2.2
style.css CHANGED
@@ -1,5 +1,6 @@
1
  h1 {
2
  text-align: center;
 
3
  }
4
  table a {
5
  background-color: transparent;
@@ -16,7 +17,3 @@ a:hover {
16
  table, th, td {
17
  border: 1px solid;
18
  }
19
- img#visitor-badge {
20
- display: block;
21
- margin: auto;
22
- }
 
1
  h1 {
2
  text-align: center;
3
+ display: block;
4
  }
5
  table a {
6
  background-color: transparent;
 
17
  table, th, td {
18
  border: 1px solid;
19
  }