bluenevus commited on
Commit
fb2ad24
·
verified ·
1 Parent(s): 659ffc3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -257,6 +257,15 @@ def update_document_type(*args):
257
 
258
  return dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update
259
 
 
 
 
 
 
 
 
 
 
260
  @app.callback(
261
  Output('document-preview', 'children', allow_duplicate=True),
262
  Output('loading-output', 'children', allow_duplicate=True),
@@ -290,13 +299,6 @@ def generate_document_preview(n_clicks, document_source, specific_document):
290
  current_document = generate_document(document_type, [specific_document, shredded_document])
291
  else:
292
  current_document = generate_document(document_type, [shredded_document])
293
- elif document_type == "Red":
294
- if 'Pink Review' not in generated_documents:
295
- return html.Div("Please complete Pink Review first."), "", "Please complete Pink Review first."
296
- if document_source == 'uploaded' and specific_document:
297
- current_document = generate_document(document_type, [specific_document, generated_documents['Pink Review'], shredded_document])
298
- else:
299
- current_document = generate_document(document_type, [generated_documents['Pink Review'], shredded_document])
300
  elif document_type == "Red":
301
  if 'Pink Review' not in generated_documents:
302
  return html.Div("Please complete Pink Review first."), "", "Please complete Pink Review first."
@@ -330,7 +332,6 @@ def generate_document_preview(n_clicks, document_source, specific_document):
330
  current_document = generate_document(document_type, [shredded_document])
331
 
332
  generated_documents[document_type] = current_document
333
-
334
  return dcc.Markdown(current_document), f"{document_type} generated", f"{document_type} document generated successfully."
335
  except Exception as e:
336
  print(f"Error generating document: {str(e)}")
 
257
 
258
  return dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update
259
 
260
+ @app.callback(
261
+ Output('document-preview', 'children', allow_duplicate=True),
262
+ Output('loading-output', 'children', allow_duplicate=True),
263
+ Output('status-bar', 'children', allow_duplicate=True),
264
+ Input('btn-generate-document', 'n_clicks'),
265
+ State('document-source', 'value'),
266
+ State('specific-document-name', 'children'),
267
+ prevent_initial_call=True
268
+ )
269
  @app.callback(
270
  Output('document-preview', 'children', allow_duplicate=True),
271
  Output('loading-output', 'children', allow_duplicate=True),
 
299
  current_document = generate_document(document_type, [specific_document, shredded_document])
300
  else:
301
  current_document = generate_document(document_type, [shredded_document])
 
 
 
 
 
 
 
302
  elif document_type == "Red":
303
  if 'Pink Review' not in generated_documents:
304
  return html.Div("Please complete Pink Review first."), "", "Please complete Pink Review first."
 
332
  current_document = generate_document(document_type, [shredded_document])
333
 
334
  generated_documents[document_type] = current_document
 
335
  return dcc.Markdown(current_document), f"{document_type} generated", f"{document_type} document generated successfully."
336
  except Exception as e:
337
  print(f"Error generating document: {str(e)}")