Markitdown / app.py
AlirezaF138's picture
Update app.py
b656dde verified
raw
history blame
702 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", lines=15, interactive=True), # Make the output scrollable
gr.Button("Copy to Clipboard", type="copy", value="Markdown Output") # Add Copy button
],
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()