dmvaldman commited on
Commit
f3dcb90
β€’
1 Parent(s): ab3d678

Initial commit of papers

Browse files
Files changed (7) hide show
  1. .gitignore +1 -0
  2. README.md +1 -1
  3. app.py +70 -0
  4. get_submissions.py +41 -0
  5. iclr_submissions.csv +0 -0
  6. paper_list.py +79 -0
  7. style.css +22 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ __pycache__
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: ICLR2023
3
  emoji: πŸ“‰
4
  colorFrom: indigo
5
  colorTo: indigo
 
1
  ---
2
+ title: ICLR2023 Paper Submissions
3
  emoji: πŸ“‰
4
  colorFrom: indigo
5
  colorTo: indigo
app.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ from __future__ import annotations
4
+
5
+ import gradio as gr
6
+
7
+ from paper_list import PaperList
8
+
9
+ DESCRIPTION = '# ICLR 2023 Paper Submissions'
10
+ NOTES = '''
11
+ - [ICLR 2023](https://openreview.net/group?id=ICLR.cc/2023/Conference)
12
+ - [List of submitted papers](https://docs.google.com/spreadsheets/d/1dQMjjetud2edTEREdLiuD4giC244lxY67ZxaL7NiMUc/edit#gid=1277917086)
13
+ '''
14
+
15
+
16
+ def main():
17
+ paper_list = PaperList()
18
+
19
+ with gr.Blocks(css='style.css') as demo:
20
+ gr.Markdown(DESCRIPTION)
21
+
22
+ search_box = gr.Textbox(
23
+ label='Search Title',
24
+ placeholder=
25
+ 'You can search for titles with regular expressions. e.g. (?<!sur)face',
26
+ max_lines=1)
27
+
28
+ case_sensitive = gr.Checkbox(label='Case Sensitive')
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
+ gr.Markdown(NOTES)
36
+
37
+ demo.load(fn=paper_list.render,
38
+ inputs=[
39
+ search_box,
40
+ case_sensitive
41
+ ],
42
+ outputs=[
43
+ number_of_papers,
44
+ table,
45
+ ])
46
+ search_box.submit(fn=paper_list.render,
47
+ inputs=[
48
+ search_box,
49
+ case_sensitive
50
+ ],
51
+ outputs=[
52
+ number_of_papers,
53
+ table,
54
+ ])
55
+
56
+ search_button.click(fn=paper_list.render,
57
+ inputs=[
58
+ search_box,
59
+ case_sensitive
60
+ ],
61
+ outputs=[
62
+ number_of_papers,
63
+ table,
64
+ ])
65
+
66
+ demo.launch(enable_queue=True, share=False)
67
+
68
+
69
+ if __name__ == '__main__':
70
+ main()
get_submissions.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import requests
3
+ import csv
4
+
5
+ offset = 0
6
+ limit = 1000
7
+ max_count = 4944
8
+
9
+ base_url = 'https://api.openreview.net'
10
+
11
+ all_papers = []
12
+ while offset < max_count:
13
+ limit = min(limit, max_count - offset)
14
+
15
+ print(offset, limit)
16
+ url = base_url + f"/notes?details=invitation%2Coriginal&offset={offset}&limit={limit}&invitation=ICLR.cc%2F2023%2FConference%2F-%2FBlind_Submission"
17
+
18
+ response = requests.get(url)
19
+ papers = json.loads(response.text)['notes']
20
+ all_papers += papers
21
+
22
+ offset += limit
23
+
24
+
25
+
26
+ with open('iclr_submissions.csv', 'w', encoding='UTF8', newline='') as f:
27
+ header = ['title', 'url', 'pdf', 'tldr', 'abstract', 'keywords']
28
+ writer = csv.writer(f)
29
+ writer.writerow(header)
30
+
31
+ for paper in all_papers:
32
+ content = paper['content']
33
+
34
+ title = content['title']
35
+ url = f'https://openreview.net/forum?id={paper["forum"]}'
36
+ pdf = f'https://openreview.net/pdf?id={paper["forum"]}'
37
+ tldr = content.get('TL;DR', '')
38
+ abstract = content['abstract']
39
+ keywords = ', '.join(content['keywords'])
40
+
41
+ writer.writerow([title, url, pdf, tldr, abstract, keywords])
iclr_submissions.csv ADDED
The diff for this file is too large to render. See raw diff
 
paper_list.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import pandas as pd
4
+ import requests
5
+ from huggingface_hub.hf_api import SpaceInfo
6
+
7
+
8
+ class PaperList:
9
+ def __init__(self):
10
+ self.organization_name = 'ICLR2023'
11
+ self.table = pd.read_csv('iclr_submissions.csv')
12
+ self._preprocess_table()
13
+
14
+ self.table_header = '''
15
+ <tr>
16
+ <td width="25%">Title</td>
17
+ <td width="5%">PDF</td>
18
+ <td width="20%">Tldr</td>
19
+ <td width="50%">Abstract</td>
20
+ </tr>'''
21
+
22
+ @staticmethod
23
+ def load_space_info(author: str) -> list[SpaceInfo]:
24
+ path = 'https://huggingface.co/api/spaces'
25
+ r = requests.get(path, params={'author': author})
26
+ d = r.json()
27
+ return [SpaceInfo(**x) for x in d]
28
+
29
+ def add_spaces_to_table(self, organization_name: str,
30
+ df: pd.DataFrame) -> pd.DataFrame:
31
+ spaces = self.load_space_info(organization_name)
32
+ name2space = {
33
+ s.id.split('/')[1].lower(): f'https://huggingface.co/spaces/{s.id}'
34
+ for s in spaces
35
+ }
36
+ return df
37
+
38
+ def _preprocess_table(self) -> None:
39
+ self.table = self.add_spaces_to_table(self.organization_name,
40
+ self.table)
41
+ self.table['title_lowercase'] = self.table.title.str.lower()
42
+
43
+ rows = []
44
+ for row in self.table.itertuples():
45
+ paper = f'<a href="{row.url}" target="_blank">{row.title}</a>' if isinstance(
46
+ row.url, str) else row.title
47
+ pdf = f'<a href="{row.pdf}" target="_blank">pdf</a>' if isinstance(
48
+ row.pdf, str) else ''
49
+ tldr = row.tldr if isinstance(row.tldr, str) else ''
50
+
51
+ row = f'''
52
+ <tr>
53
+ <td>{paper}</td>
54
+ <td>{pdf}</td>
55
+ <td>{tldr}</td>
56
+ <td>{row.abstract}</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) -> tuple[int, str]:
62
+ df = self.add_spaces_to_table(self.organization_name, 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
+
69
+ return len(df), self.to_html(df, self.table_header)
70
+
71
+ @staticmethod
72
+ def to_html(df: pd.DataFrame, table_header: str) -> str:
73
+ table_data = ''.join(df.html_table_content)
74
+ html = f'''
75
+ <table>
76
+ {table_header}
77
+ {table_data}
78
+ </table>'''
79
+ return html
style.css ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ h1 {
2
+ text-align: center;
3
+ }
4
+
5
+ table a {
6
+ background-color: transparent;
7
+ color: #58a6ff;
8
+ text-decoration: none;
9
+ }
10
+
11
+ a:active, a:hover {
12
+ outline-width: 0;
13
+ }
14
+
15
+ a:hover {
16
+ text-decoration: underline;
17
+ }
18
+
19
+ table, th, td {
20
+ border: 1px solid;
21
+ padding: 8px;
22
+ }