Markitdown / app.py
AlirezaF138's picture
Update app.py
c370c20 verified
raw
history blame contribute delete
707 Bytes
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()