Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,24 +6,16 @@ def convert_to_markdown(file):
|
|
6 |
result = markitdown.convert(file.name)
|
7 |
return result.text_content
|
8 |
|
9 |
-
# Create Gradio interface
|
10 |
iface = gr.Interface(
|
11 |
fn=convert_to_markdown,
|
12 |
inputs=gr.File(label="Upload your file"),
|
13 |
outputs=[
|
14 |
-
gr.Textbox(label="Markdown Output", lines=
|
15 |
-
gr.Button("Copy to Clipboard") #
|
16 |
],
|
17 |
title="File to Markdown Converter",
|
18 |
description="Upload a file to convert its content to Markdown using Microsoft's markitdown library.",
|
19 |
-
layout="vertical"
|
20 |
)
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
return text # This is handled automatically by Gradio
|
25 |
-
|
26 |
-
# Bind copy button to copy functionality
|
27 |
-
iface.load(fn=None, inputs=None, outputs=None, api_name="copy")
|
28 |
-
|
29 |
-
iface.launch()
|
|
|
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=[
|
13 |
+
gr.Textbox(label="Markdown Output", lines=15, interactive=True), # Make the output scrollable
|
14 |
+
gr.Button("Copy to Clipboard", type="copy", value="Markdown Output") # Add Copy button
|
15 |
],
|
16 |
title="File to Markdown Converter",
|
17 |
description="Upload a file to convert its content to Markdown using Microsoft's markitdown library.",
|
|
|
18 |
)
|
19 |
|
20 |
+
if __name__ == "__main__":
|
21 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|