bluenevus commited on
Commit
a166383
·
verified ·
1 Parent(s): 1879f8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -2,7 +2,7 @@ import base64
2
  import io
3
  import os
4
  import zipfile
5
- from dash import Dash, dcc, html, Input, Output, State, callback_context
6
  import dash_bootstrap_components as dbc
7
  from docx import Document
8
  import markdown
@@ -64,7 +64,7 @@ def process_docx(contents, filename):
64
  def update_output(list_of_contents, list_of_names, n_clicks, contents, filenames):
65
  ctx = callback_context
66
  if not ctx.triggered:
67
- return dash.no_update
68
 
69
  if ctx.triggered[0]['prop_id'] == 'upload-data.contents':
70
  if list_of_contents is not None:
@@ -75,14 +75,14 @@ def update_output(list_of_contents, list_of_names, n_clicks, contents, filenames
75
  ]) for name in list_of_names
76
  ]
77
  return children, False, 100, {"visibility": "visible"}, 0, {"visibility": "hidden"}, None
78
- return dash.no_update
79
 
80
  if ctx.triggered[0]['prop_id'] == 'convert-button.n_clicks':
81
  if n_clicks is None:
82
- return dash.no_update
83
 
84
  if not contents:
85
- return dash.no_update
86
 
87
  def process_files():
88
  processed_files = []
@@ -103,9 +103,9 @@ def update_output(list_of_contents, list_of_names, n_clicks, contents, filenames
103
  thread = threading.Thread(target=process_files)
104
  thread.start()
105
 
106
- return dash.no_update, True, 100, {"visibility": "visible"}, 0, {"visibility": "visible"}, dcc.send_bytes(process_files(), "converted_files.zip")
107
 
108
- return dash.no_update
109
 
110
  if __name__ == '__main__':
111
  print("Starting the Dash application...")
 
2
  import io
3
  import os
4
  import zipfile
5
+ from dash import Dash, dcc, html, Input, Output, State, callback_context, no_update
6
  import dash_bootstrap_components as dbc
7
  from docx import Document
8
  import markdown
 
64
  def update_output(list_of_contents, list_of_names, n_clicks, contents, filenames):
65
  ctx = callback_context
66
  if not ctx.triggered:
67
+ return no_update
68
 
69
  if ctx.triggered[0]['prop_id'] == 'upload-data.contents':
70
  if list_of_contents is not None:
 
75
  ]) for name in list_of_names
76
  ]
77
  return children, False, 100, {"visibility": "visible"}, 0, {"visibility": "hidden"}, None
78
+ return no_update
79
 
80
  if ctx.triggered[0]['prop_id'] == 'convert-button.n_clicks':
81
  if n_clicks is None:
82
+ return no_update
83
 
84
  if not contents:
85
+ return no_update
86
 
87
  def process_files():
88
  processed_files = []
 
103
  thread = threading.Thread(target=process_files)
104
  thread.start()
105
 
106
+ return no_update, True, 100, {"visibility": "visible"}, 0, {"visibility": "visible"}, dcc.send_bytes(process_files(), "converted_files.zip")
107
 
108
+ return no_update
109
 
110
  if __name__ == '__main__':
111
  print("Starting the Dash application...")