bluenevus commited on
Commit
2e88003
·
verified ·
1 Parent(s): b2ab0f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -51,9 +51,10 @@ app.layout = dbc.Container([
51
  ], className="my-3"),
52
  dbc.Button("Split PDF", id='split-button', color="primary", className="mt-3", disabled=True),
53
  dbc.Progress(id='progress-bar', className="my-3"),
54
- dbc.Spinner(id="processing-spinner", color="primary", type="border", children=[
 
55
  html.Div(id='processing-status')
56
- ]),
57
  dbc.Button("Download ZIP", id='download-button', color="success", className="mt-3", disabled=True),
58
  dcc.Download(id="download-zip"),
59
  html.Div(id='log-output', style={'whiteSpace': 'pre-line'}),
@@ -172,17 +173,18 @@ def process_pdf(contents, filename, ranges):
172
  Output('progress-bar', 'value'),
173
  Output('processing-status', 'children', allow_duplicate=True),
174
  Output('download-button', 'disabled', allow_duplicate=True),
 
175
  Input('interval-component', 'n_intervals'),
176
  prevent_initial_call=True
177
  )
178
  def update_progress(n):
179
  global progress, is_processing, generated_file
180
  if is_processing:
181
- return progress, f"Processing... {progress:.0f}% complete", True
182
  elif progress == 100 and generated_file is not None:
183
- return 100, "PDF splitting completed. Click 'Download ZIP' to get your files.", False
184
  elif progress == -1:
185
- return 0, "Error occurred during PDF splitting. Please try again.", True
186
  else:
187
  raise PreventUpdate
188
 
 
51
  ], className="my-3"),
52
  dbc.Button("Split PDF", id='split-button', color="primary", className="mt-3", disabled=True),
53
  dbc.Progress(id='progress-bar', className="my-3"),
54
+ html.Div([
55
+ dbc.Spinner(id="processing-spinner", color="primary", type="border"),
56
  html.Div(id='processing-status')
57
+ ], id='processing-container'),
58
  dbc.Button("Download ZIP", id='download-button', color="success", className="mt-3", disabled=True),
59
  dcc.Download(id="download-zip"),
60
  html.Div(id='log-output', style={'whiteSpace': 'pre-line'}),
 
173
  Output('progress-bar', 'value'),
174
  Output('processing-status', 'children', allow_duplicate=True),
175
  Output('download-button', 'disabled', allow_duplicate=True),
176
+ Output('processing-spinner', 'children'),
177
  Input('interval-component', 'n_intervals'),
178
  prevent_initial_call=True
179
  )
180
  def update_progress(n):
181
  global progress, is_processing, generated_file
182
  if is_processing:
183
+ return progress, f"Processing... {progress:.0f}% complete", True, html.Div()
184
  elif progress == 100 and generated_file is not None:
185
+ return 100, "PDF splitting completed. Click 'Download ZIP' to get your files.", False, None
186
  elif progress == -1:
187
+ return 0, "Error occurred during PDF splitting. Please try again.", True, None
188
  else:
189
  raise PreventUpdate
190