Spaces:
Running
Running
File size: 702 Bytes
441778d d6bc506 b656dde d6bc506 441778d b656dde |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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()
|