Didier commited on
Commit
2b3a14a
·
verified ·
1 Parent(s): a9c18a3

Update module_ocr.py

Browse files
Files changed (1) hide show
  1. module_ocr.py +8 -1
module_ocr.py CHANGED
@@ -110,6 +110,9 @@ def process(
110
  #
111
  with gr.Blocks() as demo:
112
 
 
 
 
113
  # Upload file to process
114
  with gr.Row():
115
  with gr.Column():
@@ -119,7 +122,7 @@ with gr.Blocks() as demo:
119
  )
120
  output_file = gr.File(
121
  label="Download OCR'ed PDF",
122
- height=50
123
  )
124
  with gr.Column():
125
  output_text = gr.Textbox(label="OCR output")
@@ -171,6 +174,10 @@ with gr.Blocks() as demo:
171
  fn=process,
172
  inputs=[input_file, src_langs, output_type],
173
  outputs=[output_text, output_file]
 
 
 
 
174
  )
175
  clear_btn.click(
176
  fn=lambda : (None, '', None),
 
110
  #
111
  with gr.Blocks() as demo:
112
 
113
+ def update_visibility(file):
114
+ return gr.update(visible=True) if file else gr.update(visible=False)
115
+
116
  # Upload file to process
117
  with gr.Row():
118
  with gr.Column():
 
122
  )
123
  output_file = gr.File(
124
  label="Download OCR'ed PDF",
125
+ visible=False # Initially not visible
126
  )
127
  with gr.Column():
128
  output_text = gr.Textbox(label="OCR output")
 
174
  fn=process,
175
  inputs=[input_file, src_langs, output_type],
176
  outputs=[output_text, output_file]
177
+ ).then(
178
+ update_visibility,
179
+ inputs=file_output,
180
+ outputs=file_output
181
  )
182
  clear_btn.click(
183
  fn=lambda : (None, '', None),