md-tools / app.py
dromerosm's picture
Create app.py
79bdf7b verified
raw
history blame
467 Bytes
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()