bluenevus commited on
Commit
f43433c
·
verified ·
1 Parent(s): e1cb2c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -131,7 +131,6 @@ def parse_file_content(contents, filename):
131
  State('upload-files', 'filename'),
132
  State('file-list', 'children')
133
  )
134
- # Update the file list creation in the update_output function
135
  def update_output(list_of_contents, list_of_names, existing_files):
136
  global uploaded_files
137
  if list_of_contents is not None:
@@ -160,8 +159,8 @@ def remove_file(n_clicks, existing_files):
160
  if not ctx.triggered or not any(n_clicks):
161
  raise PreventUpdate
162
 
163
- triggered_id = ctx.triggered[0]['prop_id'].split('.')[0]
164
- removed_file = json.loads(triggered_id)['index']
165
 
166
  uploaded_files.pop(removed_file, None)
167
  return [file for file in existing_files if file['props']['children'][1]['props']['children'] != removed_file]
 
131
  State('upload-files', 'filename'),
132
  State('file-list', 'children')
133
  )
 
134
  def update_output(list_of_contents, list_of_names, existing_files):
135
  global uploaded_files
136
  if list_of_contents is not None:
 
159
  if not ctx.triggered or not any(n_clicks):
160
  raise PreventUpdate
161
 
162
+ triggered_id = ctx.triggered[0]['prop_id']
163
+ removed_file = triggered_id.split('"index":')[1].split('}')[0].strip('"')
164
 
165
  uploaded_files.pop(removed_file, None)
166
  return [file for file in existing_files if file['props']['children'][1]['props']['children'] != removed_file]