EliottZemour commited on
Commit
8fafff8
1 Parent(s): 947164f

update demo

Browse files
__pycache__/arxiv_util.cpython-310.pyc ADDED
Binary file (1.53 kB). View file
 
__pycache__/get_paperinfo_fromurls.cpython-310.pyc ADDED
Binary file (715 Bytes). View file
 
a.html ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <head>
2
+ <meta name="viewport" content="width=device-width, initial-scale=1">
3
+ <link href="csscard.css" rel="stylesheet" type="text/css"/>
4
+
5
+ </head>
6
+
7
+ <body>
8
+
9
+ <div class="container">
10
+ <div class="square">
11
+ <div class="mask">
12
+ <div class="left">
13
+ <img src="https://static.arxiv.org/static/browse/0.3.4/images/arxiv-logo-one-color-white.svg" alt="arxiv logo">
14
+ </div>
15
+ <h2 class="right">[2208.13511]</h2>
16
+ </div>
17
+ <div class="h1">Galaxies with Fuzzy Dark Matter</div>
18
+ <ul id="links">
19
+
20
+ <li><div class="auth">Jae-Weon Lee</div></li>
21
+
22
+ </ul>
23
+ <p>This is a brief review on some properties of galaxies in the fuzzy dark
24
+ matter model, where dark matter is an ultra-light scalar particle with mass $m
25
+ = O(10^{-22})eV$. From quantum pressure, dark matter has a halo length scale
26
+ which can solve the small scale issues of the cold dark matter model, such as
27
+ the core-cusp problem, and explain many other observed mysteries of galaxies.</p>
28
+
29
+ <!-- <ul id="urllinks">
30
+ <li>
31
+ <a href="http://arxiv.org/pdf/2208.13511v1" target="_" class="button">Article</a>
32
+ </li>
33
+ <li>
34
+ <a href="http://arxiv.org/abs/2208.13511v1" target="_" class="button">Abstract</a>
35
+ </li>
36
+ </ul> -->
37
+ </div>
38
+ </div>
39
+
40
+ </body>
app.py CHANGED
@@ -27,88 +27,29 @@ class CARDS_TEMPLATE(object):
27
  with open(os.path.join(output_dir, output_htmlfile), "w") as f:
28
  f.write(self.rendered_html)
29
 
30
- # template_file = "htmlcard.html"
31
- # template_path = ""
32
- # card_template = CARDS_TEMPLATE(
33
- # path_to_template = template_path,
34
- # template_filename = template_file,
35
- # )
36
-
37
-
38
- # paper_details = get_paperinfo_fromurls("icml.txt")
39
- # card_template.render(paper_details_iterator=paper_details)
40
-
41
- html = """<head>
42
- <meta name="viewport" content="width=device-width, initial-scale=1">
43
-
44
- <link href="file/csscard.css" rel="stylesheet" type="text/css"/>
45
-
46
-
47
- </head>
48
-
49
- <body>
50
-
51
- <div class="container">
52
- <div class="square">
53
- <div class="mask">
54
- <div class="left">
55
- <img src="file/arxiv-logo.svg" alt="arxiv logo" z-index: 1>
56
- </div>
57
- <h2 class="right">[2208.14178v1]</h2>
58
- </div>
59
- <div class="h1">Observational Signatures of Galactic Turbulent Dynamos</div>
60
- <ul id="links">
61
-
62
- <li><div class="auth">Yann Carteret</div></li>
63
-
64
- <li><div class="auth">Abhijit B. Bendre</div></li>
65
-
66
- <li><div class="auth">Jennifer Schober</div></li>
67
-
68
- </ul>
69
- <p>We analyse the observational signatures of galactic magnetic fields that are
70
- self-consistently generated in magnetohydrodynamic simulations of the
71
- interstellar medium through turbulence driven by supernova (SN) explosions and
72
- differential rotation. In particular, we study the time evolution of the
73
- Faraday rotation measure (RM), synchrotron radiation, and Stokes parameters by
74
- characterising the typical structures formed in the plane of observation. We do
75
- this by defining two distinct models for both thermal and cosmic ray (CR)
76
- electron distributions. Our results indicate that the maps of RM have
77
- structures which are sheared and rendered anisotropically by differential
78
- rotation and that they depend on the choice of thermal electrons model as well
79
- as the SN rate. Synchrotron maps are qualitatively similar to the maps of the
80
- mean magnetic field along the line of sight and structures are only marginally
81
- affected by the CR model. Stokes parameters and related quantities, such as the
82
- degree of linear polarisation, are highly dependent on both frequency and
83
- resolution of the observation.</p>
84
-
85
- <!-- <ul id="urllinks">
86
- <li>
87
- <a href="http://arxiv.org/pdf/2208.14178v1" target="_" class="button">Article</a>
88
- </li>
89
- <li>
90
- <a href="http://arxiv.org/abs/2208.14178v1" target="_" class="button">Abstract</a>
91
- </li>
92
- </ul> -->
93
- </div>
94
- </div>
95
-
96
- </body>"""
97
 
98
- def text_analysis(text):
99
- return html
 
 
100
 
101
  demo = gr.Blocks()
102
  with demo:
103
  with gr.Row():
104
  text = gr.inputs.Textbox()
105
  with gr.Row():
106
- button = gr.Button("Generate reviews !")
107
  with gr.Row():
108
  card = gr.HTML()
109
 
110
  button.click(
111
- fn=text_analysis,
112
  inputs=[text],
113
  outputs=[card]
114
  )
 
27
  with open(os.path.join(output_dir, output_htmlfile), "w") as f:
28
  f.write(self.rendered_html)
29
 
30
+ template_file = "htmlcard.html"
31
+ template_path = ""
32
+ card_template = CARDS_TEMPLATE(
33
+ path_to_template = template_path,
34
+ template_filename = template_file,
35
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
+ def create_html_card(arxiv_link):
38
+ paper_details = get_paperinfo_fromurls(arxiv_link)
39
+ card_template.render(paper_details_iterator=paper_details)
40
+ return card_template.rendered_html
41
 
42
  demo = gr.Blocks()
43
  with demo:
44
  with gr.Row():
45
  text = gr.inputs.Textbox()
46
  with gr.Row():
47
+ button = gr.Button("Generate card !")
48
  with gr.Row():
49
  card = gr.HTML()
50
 
51
  button.click(
52
+ fn=create_html_card,
53
  inputs=[text],
54
  outputs=[card]
55
  )
arxiv_util.py CHANGED
@@ -3,7 +3,7 @@ import urllib
3
  import feedparser
4
  import pdb
5
 
6
- ArxivPaper = namedtuple("ArxivPaper", ["title", "authors", "abstract", "linktopdf", "linktoabs"])
7
 
8
  def arxiv_url_sanitizer(url):
9
  """
@@ -25,6 +25,7 @@ def get_paper_info(url):
25
  abstract : str
26
  linktopdf : str
27
  linktoabs : str
 
28
  """
29
  arxiv_id = url.split("/")[-1]
30
  arxiv_searchurl = "http://export.arxiv.org/api/query?id_list={}".format(arxiv_id)
@@ -51,4 +52,4 @@ def get_paper_info(url):
51
  linktopdf = link_dict["href"]
52
 
53
  # comment = paper["arxiv_comment"] # Not there in all arxiv pages.
54
- return ArxivPaper(title, authors, abstract, linktopdf, linktoabs)
 
3
  import feedparser
4
  import pdb
5
 
6
+ ArxivPaper = namedtuple("ArxivPaper", ["title", "authors", "abstract", "linktopdf", "linktoabs", "arxiv_id"])
7
 
8
  def arxiv_url_sanitizer(url):
9
  """
 
25
  abstract : str
26
  linktopdf : str
27
  linktoabs : str
28
+ arxiv_id : str
29
  """
30
  arxiv_id = url.split("/")[-1]
31
  arxiv_searchurl = "http://export.arxiv.org/api/query?id_list={}".format(arxiv_id)
 
52
  linktopdf = link_dict["href"]
53
 
54
  # comment = paper["arxiv_comment"] # Not there in all arxiv pages.
55
+ return ArxivPaper(title, authors, abstract, linktopdf, linktoabs, arxiv_id)
get_paperinfo_fromurls.py CHANGED
@@ -1,22 +1,20 @@
1
  from arxiv_util import arxiv_url_sanitizer
2
  from arxiv_util import get_paper_info
3
 
4
- def get_paperinfo_fromurls(urls_filepath):
5
  """
6
  Returns a dictionary of url entered by user
7
  and corresponding paper info from arxiv.
8
  """
9
-
10
  url_paperinfo = {}
11
- with open(urls_filepath) as f:
12
- for original_url in f.readlines():
13
- url = arxiv_url_sanitizer(original_url.strip())
14
- # print("Sanitized url = {}".format(url))
15
- try:
16
- paper_info = get_paper_info(url)
17
- except RuntimeError as e:
18
- print("[SKIP] Error processing : {}, message : {}".format(url, e))
19
- pass
20
- url_paperinfo[original_url] = paper_info
21
 
22
  return url_paperinfo
 
 
1
  from arxiv_util import arxiv_url_sanitizer
2
  from arxiv_util import get_paper_info
3
 
4
+ def get_paperinfo_fromurls(original_url):
5
  """
6
  Returns a dictionary of url entered by user
7
  and corresponding paper info from arxiv.
8
  """
 
9
  url_paperinfo = {}
10
+ url = arxiv_url_sanitizer(original_url.strip())
11
+ # print("Sanitized url = {}".format(url))
12
+ try:
13
+ paper_info = get_paper_info(url)
14
+ except RuntimeError as e:
15
+ print("[SKIP] Error processing : {}, message : {}".format(url, e))
16
+ pass
17
+ url_paperinfo[original_url] = paper_info
 
 
18
 
19
  return url_paperinfo
20
+
htmlcard.html CHANGED
@@ -1,5 +1,3 @@
1
- <!DOCTYPE html>
2
- <html>
3
  <head>
4
  <meta name="viewport" content="width=device-width, initial-scale=1">
5
  <link href="csscard.css" rel="stylesheet" type="text/css"/>
@@ -14,7 +12,7 @@
14
  <div class="left">
15
  <img src="https://static.arxiv.org/static/browse/0.3.4/images/arxiv-logo-one-color-white.svg" alt="arxiv logo">
16
  </div>
17
- <h2 class="right">{{ paper.linktoabs}}</h2>
18
  </div>
19
  <div class="h1">{{ paper.title }}</div>
20
  <ul id="links">
@@ -35,6 +33,4 @@
35
  </div>
36
  </div>
37
  {% endfor %}
38
- </body>
39
-
40
- </html>
 
 
 
1
  <head>
2
  <meta name="viewport" content="width=device-width, initial-scale=1">
3
  <link href="csscard.css" rel="stylesheet" type="text/css"/>
 
12
  <div class="left">
13
  <img src="https://static.arxiv.org/static/browse/0.3.4/images/arxiv-logo-one-color-white.svg" alt="arxiv logo">
14
  </div>
15
+ <h2 class="right">[{{ paper.arxiv_id}}]</h2>
16
  </div>
17
  <div class="h1">{{ paper.title }}</div>
18
  <ul id="links">
 
33
  </div>
34
  </div>
35
  {% endfor %}
36
+ </body>
 
 
htmlgen.ipynb ADDED
@@ -0,0 +1,490 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import os\n",
10
+ "from jinja2 import Environment, FileSystemLoader, select_autoescape\n",
11
+ "from get_paperinfo_fromurls import get_paperinfo_fromurls"
12
+ ]
13
+ },
14
+ {
15
+ "cell_type": "code",
16
+ "execution_count": 2,
17
+ "metadata": {},
18
+ "outputs": [],
19
+ "source": [
20
+ "\n",
21
+ "class CARDS_TEMPLATE(object):\n",
22
+ " def __init__(self, path_to_template, template_filename):\n",
23
+ " self.path_to_template = path_to_template\n",
24
+ " self.template_filename = template_filename\n",
25
+ " self.template = self._get_template()\n",
26
+ " self.rendered_html = None\n",
27
+ "\n",
28
+ " def _get_template(self):\n",
29
+ " env = Environment(\n",
30
+ " autoescape=select_autoescape(\n",
31
+ " enabled_extensions=('html'),\n",
32
+ " default_for_string=True,\n",
33
+ " ),\n",
34
+ " loader=FileSystemLoader(self.path_to_template)\n",
35
+ " )\n",
36
+ " return env.get_template(self.template_filename)\n",
37
+ "\n",
38
+ " def render(self, paper_details_iterator):\n",
39
+ " self.rendered_html = self.template.render(paper_details=paper_details_iterator)\n",
40
+ "\n",
41
+ " def save_html(self, output_dir=None, output_htmlfile=None):\n",
42
+ " with open(os.path.join(output_dir, output_htmlfile), \"w\") as f:\n",
43
+ " f.write(self.rendered_html)\n"
44
+ ]
45
+ },
46
+ {
47
+ "cell_type": "code",
48
+ "execution_count": null,
49
+ "metadata": {},
50
+ "outputs": [],
51
+ "source": [
52
+ "template_file = \"htmlcard.html\"\n",
53
+ "template_path = \"\"\n",
54
+ "card_template = CARDS_TEMPLATE(\n",
55
+ " path_to_template = template_path,\n",
56
+ " template_filename = template_file,\n",
57
+ " )\n",
58
+ "\n",
59
+ "def create_html_card(arxiv_link):\n",
60
+ " paper_details = get_paperinfo_fromurls(arxiv_link)\n",
61
+ " card_template.render(paper_details_iterator=paper_details)\n",
62
+ " return card_template.rendered_html"
63
+ ]
64
+ },
65
+ {
66
+ "cell_type": "code",
67
+ "execution_count": 3,
68
+ "metadata": {},
69
+ "outputs": [],
70
+ "source": []
71
+ },
72
+ {
73
+ "cell_type": "code",
74
+ "execution_count": 4,
75
+ "metadata": {},
76
+ "outputs": [],
77
+ "source": [
78
+ "paper_details = get_paperinfo_fromurls(\"https://arxiv.org/abs/2208.13511\")"
79
+ ]
80
+ },
81
+ {
82
+ "cell_type": "code",
83
+ "execution_count": 5,
84
+ "metadata": {},
85
+ "outputs": [
86
+ {
87
+ "data": {
88
+ "text/plain": [
89
+ "{'https://arxiv.org/abs/2208.13511': ArxivPaper(title='Galaxies with Fuzzy Dark Matter', authors=[{'name': 'Jae-Weon Lee'}], abstract='This is a brief review on some properties of galaxies in the fuzzy dark\\nmatter model, where dark matter is an ultra-light scalar particle with mass $m\\n= O(10^{-22})eV$. From quantum pressure, dark matter has a halo length scale\\nwhich can solve the small scale issues of the cold dark matter model, such as\\nthe core-cusp problem, and explain many other observed mysteries of galaxies.', linktopdf='http://arxiv.org/pdf/2208.13511v1', linktoabs='http://arxiv.org/abs/2208.13511v1', arxiv_id='2208.13511')}"
90
+ ]
91
+ },
92
+ "execution_count": 5,
93
+ "metadata": {},
94
+ "output_type": "execute_result"
95
+ }
96
+ ],
97
+ "source": [
98
+ "paper_details"
99
+ ]
100
+ },
101
+ {
102
+ "cell_type": "code",
103
+ "execution_count": 6,
104
+ "metadata": {},
105
+ "outputs": [],
106
+ "source": [
107
+ "card_template.render(paper_details_iterator=paper_details)"
108
+ ]
109
+ },
110
+ {
111
+ "cell_type": "code",
112
+ "execution_count": 8,
113
+ "metadata": {},
114
+ "outputs": [],
115
+ "source": [
116
+ "card_template.save_html(output_dir = template_path, output_htmlfile = \"a.html\")"
117
+ ]
118
+ },
119
+ {
120
+ "cell_type": "code",
121
+ "execution_count": 7,
122
+ "metadata": {},
123
+ "outputs": [
124
+ {
125
+ "data": {
126
+ "text/plain": [
127
+ "' <head>\\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\\n <link href=\"csscard.css\" rel=\"stylesheet\" type=\"text/css\"/>\\n\\n </head>\\n\\n <body>\\n \\n <div class=\"container\">\\n <div class=\"square\">\\n <div class=\"mask\">\\n <div class=\"left\">\\n <img src=\"https://static.arxiv.org/static/browse/0.3.4/images/arxiv-logo-one-color-white.svg\" alt=\"arxiv logo\">\\n </div>\\n <h2 class=\"right\">[2208.13511]</h2>\\n </div>\\n <div class=\"h1\">Galaxies with Fuzzy Dark Matter</div>\\n <ul id=\"links\">\\n \\n <li><div class=\"auth\">Jae-Weon Lee</div></li>\\n \\n </ul>\\n <p>This is a brief review on some properties of galaxies in the fuzzy dark\\nmatter model, where dark matter is an ultra-light scalar particle with mass $m\\n= O(10^{-22})eV$. From quantum pressure, dark matter has a halo length scale\\nwhich can solve the small scale issues of the cold dark matter model, such as\\nthe core-cusp problem, and explain many other observed mysteries of galaxies.</p>\\n\\n <!-- <ul id=\"urllinks\">\\n <li>\\n <a href=\"http://arxiv.org/pdf/2208.13511v1\" target=\"_\" class=\"button\">Article</a>\\n </li>\\n <li>\\n <a href=\"http://arxiv.org/abs/2208.13511v1\" target=\"_\" class=\"button\">Abstract</a>\\n </li>\\n </ul> -->\\n </div>\\n </div>\\n \\n </body>'"
128
+ ]
129
+ },
130
+ "execution_count": 7,
131
+ "metadata": {},
132
+ "output_type": "execute_result"
133
+ }
134
+ ],
135
+ "source": [
136
+ "card_template.rendered_html"
137
+ ]
138
+ },
139
+ {
140
+ "cell_type": "code",
141
+ "execution_count": 9,
142
+ "metadata": {},
143
+ "outputs": [
144
+ {
145
+ "name": "stdout",
146
+ "output_type": "stream",
147
+ "text": [
148
+ " <head>\n",
149
+ " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n",
150
+ " <link href=\"csscard.css\" rel=\"stylesheet\" type=\"text/css\"/>\n",
151
+ "\n",
152
+ " </head>\n",
153
+ "\n",
154
+ " <body>\n",
155
+ " \n",
156
+ " <div class=\"container\">\n",
157
+ " <div class=\"square\">\n",
158
+ " <div class=\"mask\">\n",
159
+ " <div class=\"left\">\n",
160
+ " <img src=\"https://static.arxiv.org/static/browse/0.3.4/images/arxiv-logo-one-color-white.svg\" alt=\"arxiv logo\">\n",
161
+ " </div>\n",
162
+ " <h2 class=\"right\">[2208.13511]</h2>\n",
163
+ " </div>\n",
164
+ " <div class=\"h1\">Galaxies with Fuzzy Dark Matter</div>\n",
165
+ " <ul id=\"links\">\n",
166
+ " \n",
167
+ " <li><div class=\"auth\">Jae-Weon Lee</div></li>\n",
168
+ " \n",
169
+ " </ul>\n",
170
+ " <p>This is a brief review on some properties of galaxies in the fuzzy dark\n",
171
+ "matter model, where dark matter is an ultra-light scalar particle with mass $m\n",
172
+ "= O(10^{-22})eV$. From quantum pressure, dark matter has a halo length scale\n",
173
+ "which can solve the small scale issues of the cold dark matter model, such as\n",
174
+ "the core-cusp problem, and explain many other observed mysteries of galaxies.</p>\n",
175
+ "\n",
176
+ " <!-- <ul id=\"urllinks\">\n",
177
+ " <li>\n",
178
+ " <a href=\"http://arxiv.org/pdf/2208.13511v1\" target=\"_\" class=\"button\">Article</a>\n",
179
+ " </li>\n",
180
+ " <li>\n",
181
+ " <a href=\"http://arxiv.org/abs/2208.13511v1\" target=\"_\" class=\"button\">Abstract</a>\n",
182
+ " </li>\n",
183
+ " </ul> -->\n",
184
+ " </div>\n",
185
+ " </div>\n",
186
+ " \n",
187
+ " </body>\n"
188
+ ]
189
+ }
190
+ ],
191
+ "source": [
192
+ "print(card_template.rendered_html)"
193
+ ]
194
+ },
195
+ {
196
+ "cell_type": "code",
197
+ "execution_count": 94,
198
+ "metadata": {},
199
+ "outputs": [],
200
+ "source": [
201
+ "html = \"\"\"<head>\n",
202
+ " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n",
203
+ " \n",
204
+ " <style>\n",
205
+ " @import url(\"https://fonts.googleapis.com/css?family=Merriweather|Open+Sans\");\n",
206
+ "\n",
207
+ ".container {\n",
208
+ " display: flex;\n",
209
+ " justify-content: center;\n",
210
+ " padding: 80px;\n",
211
+ "}\n",
212
+ "\n",
213
+ "ul {\n",
214
+ " list-style-type: none;\n",
215
+ " display: flex;\n",
216
+ " float: none;\n",
217
+ " justify-content: center;\n",
218
+ " align-items: center;\n",
219
+ "}\n",
220
+ "\n",
221
+ "#urllinks li {\n",
222
+ " padding: 0px 30px 5px 5px;\n",
223
+ "}\n",
224
+ "\n",
225
+ ".square {\n",
226
+ " width: 700px;\n",
227
+ " background: white;\n",
228
+ " border-radius: 4px;\n",
229
+ " box-shadow: 0px 20px 50px #d9dbdf;\n",
230
+ "}\n",
231
+ "\n",
232
+ ".mask {\n",
233
+ " width: 700px;\n",
234
+ " height: 65px;\n",
235
+ " clip: rect(0px, 700px, 150px, 0px);\n",
236
+ " border-radius: 4px;\n",
237
+ " position: absolute;\n",
238
+ " background-color: #b31b1b;\n",
239
+ " display: flex;\n",
240
+ "}\n",
241
+ "\n",
242
+ ".mask .left,\n",
243
+ ".mask .right {\n",
244
+ " flex: 1;\n",
245
+ "}\n",
246
+ "\n",
247
+ "img {\n",
248
+ " position: absolute;\n",
249
+ " width: 60px;\n",
250
+ " padding: 20px 30px;\n",
251
+ "}\n",
252
+ "\n",
253
+ ".h1 {\n",
254
+ " margin: auto;\n",
255
+ " text-align: left;\n",
256
+ " margin-top: 90px;\n",
257
+ " padding-left: 30px;\n",
258
+ " font-family: \"Merriweather\", serif;\n",
259
+ " font-size: 22px;\n",
260
+ "}\n",
261
+ "\n",
262
+ "h2 {\n",
263
+ " color: white;\n",
264
+ " text-align: center;\n",
265
+ " font-size: 14px;\n",
266
+ " padding: 10px 0px;\n",
267
+ " font-family: \"Open Sans\", sans-serif;\n",
268
+ " font-weight: 400;\n",
269
+ "}\n",
270
+ "\n",
271
+ "p {\n",
272
+ " text-align: justify;\n",
273
+ " padding-left: 30px;\n",
274
+ " padding-right: 30px;\n",
275
+ " font-family: \"Open Sans\", sans-serif;\n",
276
+ " font-size: 12px;\n",
277
+ " color: #949494;\n",
278
+ " line-height: 18px;\n",
279
+ "}\n",
280
+ "\n",
281
+ ".auth {\n",
282
+ " text-align: justify;\n",
283
+ " padding-left: 0px;\n",
284
+ " padding-right: 20px;\n",
285
+ " font-family: \"Open Sans\", sans-serif;\n",
286
+ " font-size: 14px;\n",
287
+ " line-height: 18px;\n",
288
+ "}\n",
289
+ "\n",
290
+ ".button {\n",
291
+ " background-color: #b31b1b;\n",
292
+ " color: white;\n",
293
+ " width: 150px;\n",
294
+ " padding: 10px 10px;\n",
295
+ " border-radius: 3px;\n",
296
+ " text-align: center;\n",
297
+ " text-decoration: none;\n",
298
+ " display: block;\n",
299
+ " margin-top: 20px;\n",
300
+ " margin-left: 20px;\n",
301
+ " margin-right: 20px;\n",
302
+ " font-size: 12px;\n",
303
+ " cursor: pointer;\n",
304
+ " font-family: \"merriweather\";\n",
305
+ "}\n",
306
+ "\n",
307
+ " </style>\n",
308
+ "\n",
309
+ "\n",
310
+ " </head>\n",
311
+ "\n",
312
+ " <body>\n",
313
+ " \n",
314
+ " <div class=\"container\">\n",
315
+ " <div class=\"square\">\n",
316
+ " <div class=\"mask\">\n",
317
+ " <h2 class=\"left\">\n",
318
+ " <img src=\"https://static.arxiv.org/static/browse/0.3.4/images/arxiv-logo-one-color-white.svg\" alt=\"arxiv logo\">\n",
319
+ " </h2>\n",
320
+ " <h2 class=\"right\">http://arxiv.org/abs/2208.14178v1</h2>\n",
321
+ " </div>\n",
322
+ " <div class=\"h1\">Observational Signatures of Galactic Turbulent Dynamos</div>\n",
323
+ " <ul id=\"links\">\n",
324
+ " \n",
325
+ " <li><div class=\"auth\">Yann Carteret</div></li>\n",
326
+ " \n",
327
+ " <li><div class=\"auth\">Abhijit B. Bendre</div></li>\n",
328
+ " \n",
329
+ " <li><div class=\"auth\">Jennifer Schober</div></li>\n",
330
+ " \n",
331
+ " </ul>\n",
332
+ " <p>We analyse the observational signatures of galactic magnetic fields that are\n",
333
+ "self-consistently generated in magnetohydrodynamic simulations of the\n",
334
+ "interstellar medium through turbulence driven by supernova (SN) explosions and\n",
335
+ "differential rotation. In particular, we study the time evolution of the\n",
336
+ "Faraday rotation measure (RM), synchrotron radiation, and Stokes parameters by\n",
337
+ "characterising the typical structures formed in the plane of observation. We do\n",
338
+ "this by defining two distinct models for both thermal and cosmic ray (CR)\n",
339
+ "electron distributions. Our results indicate that the maps of RM have\n",
340
+ "structures which are sheared and rendered anisotropically by differential\n",
341
+ "rotation and that they depend on the choice of thermal electrons model as well\n",
342
+ "as the SN rate. Synchrotron maps are qualitatively similar to the maps of the\n",
343
+ "mean magnetic field along the line of sight and structures are only marginally\n",
344
+ "affected by the CR model. Stokes parameters and related quantities, such as the\n",
345
+ "degree of linear polarisation, are highly dependent on both frequency and\n",
346
+ "resolution of the observation.</p>\n",
347
+ "\n",
348
+ " <!-- <ul id=\"urllinks\">\n",
349
+ " <li>\n",
350
+ " <a href=\"http://arxiv.org/pdf/2208.14178v1\" target=\"_\" class=\"button\">Article</a>\n",
351
+ " </li>\n",
352
+ " <li>\n",
353
+ " <a href=\"http://arxiv.org/abs/2208.14178v1\" target=\"_\" class=\"button\">Abstract</a>\n",
354
+ " </li>\n",
355
+ " </ul> -->\n",
356
+ " </div>\n",
357
+ " </div>\n",
358
+ " \n",
359
+ " </body>\"\"\""
360
+ ]
361
+ },
362
+ {
363
+ "cell_type": "code",
364
+ "execution_count": 95,
365
+ "metadata": {},
366
+ "outputs": [],
367
+ "source": [
368
+ "import gradio as gr\n",
369
+ "\n",
370
+ "def text_analysis(text):\n",
371
+ " return html\n",
372
+ "\n",
373
+ "\n",
374
+ "# demo = gr.Interface(\n",
375
+ "# text_analysis,\n",
376
+ "# gr.Textbox(placeholder=\"Enter sentence here...\"),\n",
377
+ "# gr.HTML(),\n",
378
+ "# examples=[\n",
379
+ "# [\"What a beautiful morning for a walk!\"],\n",
380
+ "# [\"It was the best of times, it was the worst of times.\"],\n",
381
+ "# ],\n",
382
+ "# )\n"
383
+ ]
384
+ },
385
+ {
386
+ "cell_type": "code",
387
+ "execution_count": 96,
388
+ "metadata": {},
389
+ "outputs": [
390
+ {
391
+ "name": "stderr",
392
+ "output_type": "stream",
393
+ "text": [
394
+ "/Users/eliott/Desktop/arxiv-cards/venv/lib/python3.10/site-packages/gradio/inputs.py:26: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
395
+ " warnings.warn(\n",
396
+ "/Users/eliott/Desktop/arxiv-cards/venv/lib/python3.10/site-packages/gradio/deprecation.py:40: UserWarning: `optional` parameter is deprecated, and it has no effect\n",
397
+ " warnings.warn(value)\n",
398
+ "/Users/eliott/Desktop/arxiv-cards/venv/lib/python3.10/site-packages/gradio/deprecation.py:40: UserWarning: `numeric` parameter is deprecated, and it has no effect\n",
399
+ " warnings.warn(value)\n",
400
+ "/Users/eliott/Desktop/arxiv-cards/venv/lib/python3.10/site-packages/gradio/deprecation.py:40: UserWarning: The 'type' parameter has been deprecated. Use the Number component instead.\n",
401
+ " warnings.warn(value)\n"
402
+ ]
403
+ },
404
+ {
405
+ "name": "stdout",
406
+ "output_type": "stream",
407
+ "text": [
408
+ "Running on local URL: http://127.0.0.1:7866/\n",
409
+ "\n",
410
+ "To create a public link, set `share=True` in `launch()`.\n"
411
+ ]
412
+ },
413
+ {
414
+ "data": {
415
+ "text/html": [
416
+ "<div><iframe src=\"http://127.0.0.1:7866/\" width=\"900\" height=\"500\" allow=\"autoplay; camera; microphone;\" frameborder=\"0\" allowfullscreen></iframe></div>"
417
+ ],
418
+ "text/plain": [
419
+ "<IPython.core.display.HTML object>"
420
+ ]
421
+ },
422
+ "metadata": {},
423
+ "output_type": "display_data"
424
+ },
425
+ {
426
+ "data": {
427
+ "text/plain": [
428
+ "(<gradio.routes.App at 0x133347cd0>, 'http://127.0.0.1:7866/', None)"
429
+ ]
430
+ },
431
+ "execution_count": 96,
432
+ "metadata": {},
433
+ "output_type": "execute_result"
434
+ }
435
+ ],
436
+ "source": [
437
+ "demo = gr.Blocks()\n",
438
+ "with demo:\n",
439
+ " with gr.Row():\n",
440
+ " text = gr.inputs.Textbox()\n",
441
+ " with gr.Row():\n",
442
+ " button = gr.Button(\"Generate reviews !\")\n",
443
+ " with gr.Row():\n",
444
+ " card = gr.HTML()\n",
445
+ "\n",
446
+ " button.click(\n",
447
+ " fn=text_analysis,\n",
448
+ " inputs=[text],\n",
449
+ " outputs=[card]\n",
450
+ " )\n",
451
+ "\n",
452
+ "demo.launch()"
453
+ ]
454
+ },
455
+ {
456
+ "cell_type": "code",
457
+ "execution_count": null,
458
+ "metadata": {},
459
+ "outputs": [],
460
+ "source": []
461
+ }
462
+ ],
463
+ "metadata": {
464
+ "kernelspec": {
465
+ "display_name": "Python 3.10.6 ('venv': venv)",
466
+ "language": "python",
467
+ "name": "python3"
468
+ },
469
+ "language_info": {
470
+ "codemirror_mode": {
471
+ "name": "ipython",
472
+ "version": 3
473
+ },
474
+ "file_extension": ".py",
475
+ "mimetype": "text/x-python",
476
+ "name": "python",
477
+ "nbconvert_exporter": "python",
478
+ "pygments_lexer": "ipython3",
479
+ "version": "3.10.6"
480
+ },
481
+ "orig_nbformat": 4,
482
+ "vscode": {
483
+ "interpreter": {
484
+ "hash": "ae98d664624800dd4d9fc88411f6d5cdeab1df903964a5ddc213cbd271aad7df"
485
+ }
486
+ }
487
+ },
488
+ "nbformat": 4,
489
+ "nbformat_minor": 2
490
+ }