import gradio as gr def render_markdown(md_file): if md_file is not None: content = md_file.decode("utf-8") return content return "" with gr.Blocks() as demo: gr.Markdown("## Upload a Markdown file to render it") file_input = gr.File(label="Upload Markdown File", type="binary") output = gr.Markdown(show_copy_button=True, value="The generated insighsts will appear here...", latex_delimiters=[ {"left": "\\[", "right": "\\]", "display": True}, {"left": "\\(", "right": "\\)", "display": False}, ]) file_input.change(fn=render_markdown, inputs=file_input, outputs=output) if __name__ == "__main__": demo.queue(api_open=False, max_size=3).launch()