File size: 5,870 Bytes
63135a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413c0d7
63135a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
import os
from jinja2 import Environment, FileSystemLoader, select_autoescape
from get_paperinfo_fromurls import get_paperinfo_fromurls
import gradio as gr

class CARDS_TEMPLATE(object):
    def __init__(self, path_to_template, template_filename):
        self.path_to_template = path_to_template
        self.template_filename = template_filename
        self.template = self._get_template()
        self.rendered_html = None

    def _get_template(self):
        env = Environment(
                    autoescape=select_autoescape(
                        enabled_extensions=('html'),
                        default_for_string=True,
                    ),
                    loader=FileSystemLoader(self.path_to_template)
                )
        return env.get_template(self.template_filename)

    def render(self, paper_details_iterator):
        self.rendered_html = self.template.render(paper_details=paper_details_iterator)

    def save_html(self, output_dir=None, output_htmlfile=None):
        with open(os.path.join(output_dir, output_htmlfile), "w") as f:
            f.write(self.rendered_html)

# template_file = "htmlcard.html"
# template_path = ""
# card_template = CARDS_TEMPLATE(
#                 path_to_template = template_path,
#                 template_filename = template_file,
#                             )


# paper_details = get_paperinfo_fromurls("icml.txt")
# card_template.render(paper_details_iterator=paper_details)

html = """<head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        
        <style>
        @import url("https://fonts.googleapis.com/css?family=Merriweather|Open+Sans");

.container {
  display: flex;
  justify-content: center;
  padding: 80px;
}

ul {
  list-style-type: none;
  display: flex;
  float: none;
  justify-content: center;
  align-items: center;
}

#urllinks li {
  padding: 0px 30px 5px 5px;
}

.square {
  width: 700px;
  background: white;
  border-radius: 4px;
  box-shadow: 0px 20px 50px #d9dbdf;
}

.mask {
  width: 700px;
  height: 65px;
  clip: rect(0px, 700px, 150px, 0px);
  border-radius: 4px;
  position: absolute;
  background-color: #b31b1b;
  display: flex;
}

.mask .left,
.mask .right {
  flex: 1;
}

img {
  position: absolute;
  width: 60px;
  padding: 20px 30px;
}

.h1 {
  margin: auto;
  text-align: left;
  margin-top: 90px;
  padding-left: 30px;
  font-family: "Merriweather", serif;
  font-size: 22px;
}

h2 {
  color: white;
  text-align: center;
  font-size: 14px;
  padding: 10px 0px;
  font-family: "Open Sans", sans-serif;
  font-weight: 400;
}

p {
  text-align: justify;
  padding-left: 30px;
  padding-right: 30px;
  font-family: "Open Sans", sans-serif;
  font-size: 12px;
  color: #949494;
  line-height: 18px;
}

.auth {
  text-align: justify;
  padding-left: 0px;
  padding-right: 20px;
  font-family: "Open Sans", sans-serif;
  font-size: 14px;
  line-height: 18px;
}

.button {
  background-color: #b31b1b;
  color: white;
  width: 150px;
  padding: 10px 10px;
  border-radius: 3px;
  text-align: center;
  text-decoration: none;
  display: block;
  margin-top: 20px;
  margin-left: 20px;
  margin-right: 20px;
  font-size: 12px;
  cursor: pointer;
  font-family: "merriweather";
}

        </style>


    </head>

    <body>
    
        <div class="container">
            <div class="square">
            <div class="mask">
                <h2 class="left">
                <img src="file/arxiv-logo.svg" alt="arxiv logo">
                </h2>
                <h2 class="right">http://arxiv.org/abs/2208.14178v1</h2>
            </div>
            <div class="h1">Observational Signatures of Galactic Turbulent Dynamos</div>
            <ul id="links">
                
                        <li><div class="auth">Yann Carteret</div></li>
                
                        <li><div class="auth">Abhijit B. Bendre</div></li>
                
                        <li><div class="auth">Jennifer Schober</div></li>
                
            </ul>
            <p>We analyse the observational signatures of galactic magnetic fields that are
self-consistently generated in magnetohydrodynamic simulations of the
interstellar medium through turbulence driven by supernova (SN) explosions and
differential rotation. In particular, we study the time evolution of the
Faraday rotation measure (RM), synchrotron radiation, and Stokes parameters by
characterising the typical structures formed in the plane of observation. We do
this by defining two distinct models for both thermal and cosmic ray (CR)
electron distributions. Our results indicate that the maps of RM have
structures which are sheared and rendered anisotropically by differential
rotation and that they depend on the choice of thermal electrons model as well
as the SN rate. Synchrotron maps are qualitatively similar to the maps of the
mean magnetic field along the line of sight and structures are only marginally
affected by the CR model. Stokes parameters and related quantities, such as the
degree of linear polarisation, are highly dependent on both frequency and
resolution of the observation.</p>

            <!-- <ul id="urllinks">
                <li>
                <a href="http://arxiv.org/pdf/2208.14178v1" target="_" class="button">Article</a>
                </li>
                <li>
                <a href="http://arxiv.org/abs/2208.14178v1" target="_" class="button">Abstract</a>
                </li>
            </ul> -->
            </div>
        </div>
    
    </body>"""

def text_analysis(text):
    return html

demo = gr.Blocks()
with demo:
    with gr.Row():
        text = gr.inputs.Textbox()
    with gr.Row():
        button = gr.Button("Generate reviews !")
    with gr.Row():
        card = gr.HTML()

    button.click(
        fn=text_analysis,
        inputs=[text],
        outputs=[card]
    )

demo.launch()