File size: 707 Bytes
441778d
 
 
 
 
 
 
 
 
 
 
c370c20
 
 
 
 
 
441778d
 
 
 
b656dde
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from markitdown import MarkItDown

def convert_to_markdown(file):
    markitdown = MarkItDown()
    result = markitdown.convert(file.name)
    return result.text_content

iface = gr.Interface(
    fn=convert_to_markdown,
    inputs=gr.File(label="Upload your file"),
    outputs=gr.Textbox(
        label="Markdown Output",
        show_copy_button=True,
        lines=10,  # Number of lines to display before scrolling
        max_lines=20  # Maximum number of lines before scrolling
    ),
    title="File to Markdown Converter",
    description="Upload a file to convert its content to Markdown using Microsoft's markitdown library.",
)

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