Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def render_markdown(md_file):
|
4 |
+
if md_file is not None:
|
5 |
+
content = md_file.read().decode("utf-8")
|
6 |
+
return content
|
7 |
+
return ""
|
8 |
+
|
9 |
+
with gr.Blocks() as demo:
|
10 |
+
gr.Markdown("## Upload a Markdown file to render it")
|
11 |
+
file_input = gr.File(label="Upload Markdown File", type="file")
|
12 |
+
output = gr.Markdown()
|
13 |
+
file_input.change(fn=render_markdown, inputs=file_input, outputs=output)
|
14 |
+
|
15 |
+
if __name__ == "__main__":
|
16 |
+
demo.launch()
|