AlirezaF138 commited on
Commit
441778d
·
verified ·
1 Parent(s): b440b42

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from markitdown import MarkItDown
3
+
4
+ def convert_to_markdown(file):
5
+ markitdown = MarkItDown()
6
+ result = markitdown.convert(file.name)
7
+ return result.text_content
8
+
9
+ iface = gr.Interface(
10
+ fn=convert_to_markdown,
11
+ inputs=gr.File(label="Upload your file"),
12
+ outputs=gr.Textbox(label="Markdown Output"),
13
+ title="File to Markdown Converter",
14
+ description="Upload a file to convert its content to Markdown using Microsoft's markitdown library.",
15
+ )
16
+
17
+ if __name__ == "__main__":
18
+ iface.launch()