File size: 467 Bytes
79bdf7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr

def render_markdown(md_file):
    if md_file is not None:
        content = md_file.read().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="file")
    output = gr.Markdown()
    file_input.change(fn=render_markdown, inputs=file_input, outputs=output)

if __name__ == "__main__":
    demo.launch()