File size: 821 Bytes
79bdf7b f0a1aed 79bdf7b f0a1aed 5e0c5c4 79bdf7b 5e0c5c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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() |