Commit bb373980 authored by myhloli's avatar myhloli

feat(gradio_app): add examples accordion to the PDF conversion interface

Introduce an examples accordion within the Gradio application to provide users with
a selection of sample PDFs for demonstration purposes. The added functionality allows
users to quickly test the PDF conversion feature with various document types.
parent 20212a37
...@@ -150,6 +150,13 @@ if __name__ == "__main__": ...@@ -150,6 +150,13 @@ if __name__ == "__main__":
change_bu = gr.Button("Convert") change_bu = gr.Button("Convert")
clear_bu = gr.ClearButton([pdf_show], value="Clear") clear_bu = gr.ClearButton([pdf_show], value="Clear")
pdf_show = PDF(label="Please upload pdf", interactive=True, height=800) pdf_show = PDF(label="Please upload pdf", interactive=True, height=800)
with gr.Accordion("Examples:"):
example_root = os.path.join(os.path.dirname(__file__), "examples")
gr.Examples(
examples=[os.path.join(example_root, _) for _ in os.listdir(example_root) if
_.endswith("pdf")],
inputs=pdf_show,
)
with gr.Column(variant='panel', scale=5): with gr.Column(variant='panel', scale=5):
output_file = gr.File(label="convert result", interactive=False) output_file = gr.File(label="convert result", interactive=False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment