File size: 594 Bytes
10114c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()