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 = """

arxiv logo

http://arxiv.org/abs/2208.14178v1

Observational Signatures of Galactic Turbulent Dynamos

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.

""" 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()