Spaces:
Running
on
Zero
Running
on
Zero
Liam Dyer
commited on
feat: add metadata param
Browse files
app.py
CHANGED
@@ -76,16 +76,19 @@ def convert(input_file):
|
|
76 |
# Already a plain text file that wouldn't benefit from pandoc so return the content
|
77 |
if any(input_file.endswith(ft) for ft in plain_text_filetypes):
|
78 |
with open(input_file, "r") as f:
|
79 |
-
return f.read()
|
80 |
|
81 |
if input_file.endswith(".pdf"):
|
82 |
return convert_pdf(input_file)
|
83 |
|
84 |
-
return convert_pandoc(input_file)
|
85 |
|
86 |
|
87 |
gr.Interface(
|
88 |
convert,
|
89 |
inputs=gr.File(label="Upload File", type="filepath"),
|
90 |
-
outputs=
|
|
|
|
|
|
|
91 |
).launch()
|
|
|
76 |
# Already a plain text file that wouldn't benefit from pandoc so return the content
|
77 |
if any(input_file.endswith(ft) for ft in plain_text_filetypes):
|
78 |
with open(input_file, "r") as f:
|
79 |
+
return f.read(), {}
|
80 |
|
81 |
if input_file.endswith(".pdf"):
|
82 |
return convert_pdf(input_file)
|
83 |
|
84 |
+
return convert_pandoc(input_file), {}
|
85 |
|
86 |
|
87 |
gr.Interface(
|
88 |
convert,
|
89 |
inputs=gr.File(label="Upload File", type="filepath"),
|
90 |
+
outputs=[
|
91 |
+
gr.Text(label="Markdown"),
|
92 |
+
gr.JSON(label="Metadata"),
|
93 |
+
],
|
94 |
).launch()
|