import gradio as gr def mock_ocr(f): return [[1, 2, 3], [4, 5, 6]] def export_csv(d): d.to_csv("output.csv") return gr.File.update(value="output.csv", visible=True) with gr.Blocks() as demo: with gr.Row(): file = gr.File(label="PDF file", file_types=[".pdf"]) dataframe = gr.Dataframe() with gr.Column(): button = gr.Button("Export") csv = gr.File(interactive=False, visible=False) file.change(mock_ocr, file, dataframe) button.click(export_csv, dataframe, csv) demo.launch()