bluenevus commited on
Commit
f6cc677
·
verified ·
1 Parent(s): 08a9825

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -640,29 +640,29 @@ def update_loe_output(n_clicks, upload_contents, upload_filename, shred_output):
640
  return "Click 'Generate LOE' to begin."
641
 
642
  try:
643
- if triggered_id == 'generate-loe':
644
  if upload_contents:
645
  loe_text, loe_df = generate_loe(upload_contents, is_file=True, filename=upload_filename)
646
  elif shred_output:
647
  loe_text, loe_df = generate_loe(shred_output)
648
  else:
649
  return "Please upload a document or complete the Shred tab first."
650
- else:
651
- return "Click 'Generate LOE' to begin."
652
 
653
- if isinstance(loe_text, str) and loe_text.startswith(("Unsupported file format", "Error processing document", "The document appears to be empty")):
654
- return loe_text
655
 
656
- return [
657
- dcc.Markdown(loe_text),
658
- dash_table.DataTable(
659
- data=loe_df.to_dict('records'),
660
- columns=[{'name': i, 'id': i} for i in loe_df.columns],
661
- style_table={'overflowX': 'auto'},
662
- style_cell={'textAlign': 'left', 'padding': '5px'},
663
- style_header={'backgroundColor': 'rgb(230, 230, 230)', 'fontWeight': 'bold'}
664
- )
665
- ]
 
 
666
  except Exception as e:
667
  return f"An error occurred: {str(e)}"
668
 
 
640
  return "Click 'Generate LOE' to begin."
641
 
642
  try:
643
+ if triggered_id in ['generate-loe', 'upload-loe']:
644
  if upload_contents:
645
  loe_text, loe_df = generate_loe(upload_contents, is_file=True, filename=upload_filename)
646
  elif shred_output:
647
  loe_text, loe_df = generate_loe(shred_output)
648
  else:
649
  return "Please upload a document or complete the Shred tab first."
 
 
650
 
651
+ if isinstance(loe_text, str) and loe_text.startswith(("Unsupported file format", "Error processing document", "The document appears to be empty")):
652
+ return loe_text
653
 
654
+ return [
655
+ dcc.Markdown(loe_text),
656
+ dash_table.DataTable(
657
+ data=loe_df.to_dict('records'),
658
+ columns=[{'name': i, 'id': i} for i in loe_df.columns],
659
+ style_table={'overflowX': 'auto'},
660
+ style_cell={'textAlign': 'left', 'padding': '5px'},
661
+ style_header={'backgroundColor': 'rgb(230, 230, 230)', 'fontWeight': 'bold'}
662
+ )
663
+ ]
664
+ else:
665
+ return "Click 'Generate LOE' to begin."
666
  except Exception as e:
667
  return f"An error occurred: {str(e)}"
668