Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,15 +16,12 @@ def convert_document(file, method):
|
|
16 |
|
17 |
# Output
|
18 |
converted_text = result.document.export_to_markdown()
|
19 |
-
metadata = {
|
20 |
-
"Available Attributes": available_attributes
|
21 |
-
}
|
22 |
|
23 |
-
return converted_text
|
24 |
elif method == "Marker":
|
25 |
-
return 'unsupported method'
|
26 |
else:
|
27 |
-
return 'unknown method'
|
28 |
|
29 |
with gr.Blocks() as app:
|
30 |
gr.Markdown("# Document Converter")
|
@@ -33,13 +30,12 @@ with gr.Blocks() as app:
|
|
33 |
file_input = gr.File(label="Upload Document")
|
34 |
method_input = gr.Radio(["Docling", "Marker"], label="Choose Conversion Backend")
|
35 |
output_text = gr.Textbox(label="Converted Document")
|
36 |
-
output_metadata = gr.JSON(label="Metadata")
|
37 |
|
38 |
convert_button = gr.Button("Convert")
|
39 |
convert_button.click(
|
40 |
convert_document,
|
41 |
inputs=[file_input, method_input],
|
42 |
-
outputs=[output_text
|
43 |
)
|
44 |
|
45 |
app.launch(debug=True, show_error=True)
|
|
|
16 |
|
17 |
# Output
|
18 |
converted_text = result.document.export_to_markdown()
|
|
|
|
|
|
|
19 |
|
20 |
+
return converted_text
|
21 |
elif method == "Marker":
|
22 |
+
return 'unsupported method'
|
23 |
else:
|
24 |
+
return 'unknown method'
|
25 |
|
26 |
with gr.Blocks() as app:
|
27 |
gr.Markdown("# Document Converter")
|
|
|
30 |
file_input = gr.File(label="Upload Document")
|
31 |
method_input = gr.Radio(["Docling", "Marker"], label="Choose Conversion Backend")
|
32 |
output_text = gr.Textbox(label="Converted Document")
|
|
|
33 |
|
34 |
convert_button = gr.Button("Convert")
|
35 |
convert_button.click(
|
36 |
convert_document,
|
37 |
inputs=[file_input, method_input],
|
38 |
+
outputs=[output_text]
|
39 |
)
|
40 |
|
41 |
app.launch(debug=True, show_error=True)
|