Spaces:
Running
Running
Enable MCP server for Claude integration
Browse filesAdd mcp_server=True to expose HWP conversion as an MCP tool,
allowing Claude Desktop and claude.ai users to convert HWP files directly.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
app.py
CHANGED
|
@@ -3,6 +3,18 @@ from docpler.hwp import convert
|
|
| 3 |
|
| 4 |
|
| 5 |
def hwp_to_markdown(file):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
if file is None:
|
| 7 |
return "", ""
|
| 8 |
md = convert(file.name)
|
|
@@ -26,7 +38,12 @@ with gr.Blocks(title="docpler — HWP to Markdown") as demo:
|
|
| 26 |
with gr.Tab("Preview"):
|
| 27 |
preview_output = gr.Markdown(label="Rendered preview")
|
| 28 |
|
| 29 |
-
file_input.change(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
if __name__ == "__main__":
|
| 32 |
-
demo.launch()
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
def hwp_to_markdown(file):
|
| 6 |
+
"""Convert an HWP (Korean word processor) document to Markdown.
|
| 7 |
+
|
| 8 |
+
Upload a .hwp file and get back the converted Markdown text.
|
| 9 |
+
HWP is the native format of Hangul Word Processor, widely used
|
| 10 |
+
in South Korea for government, legal, and academic documents.
|
| 11 |
+
|
| 12 |
+
Args:
|
| 13 |
+
file: The HWP file to convert (.hwp format)
|
| 14 |
+
|
| 15 |
+
Returns:
|
| 16 |
+
Converted Markdown text
|
| 17 |
+
"""
|
| 18 |
if file is None:
|
| 19 |
return "", ""
|
| 20 |
md = convert(file.name)
|
|
|
|
| 38 |
with gr.Tab("Preview"):
|
| 39 |
preview_output = gr.Markdown(label="Rendered preview")
|
| 40 |
|
| 41 |
+
file_input.change(
|
| 42 |
+
fn=hwp_to_markdown,
|
| 43 |
+
inputs=file_input,
|
| 44 |
+
outputs=[raw_output, preview_output],
|
| 45 |
+
api_name="convert",
|
| 46 |
+
)
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|
| 49 |
+
demo.launch(mcp_server=True)
|