Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -168,10 +168,13 @@ def update_output(list_of_contents, list_of_names, existing_files):
|
|
168 |
]))
|
169 |
if existing_files is None:
|
170 |
existing_files = []
|
|
|
|
|
171 |
shredded_document = None # Reset shredded document when new files are uploaded
|
172 |
-
|
173 |
-
|
174 |
-
|
|
|
175 |
@app.callback(
|
176 |
Output('file-list', 'children', allow_duplicate=True),
|
177 |
Output('status-bar', 'children', allow_duplicate=True),
|
@@ -223,19 +226,7 @@ Now, generate the {document_type}:
|
|
223 |
response = model.generate_content(prompt)
|
224 |
return response.text
|
225 |
|
226 |
-
|
227 |
-
Output('document-preview', 'children'),
|
228 |
-
Output('loading-output', 'children'),
|
229 |
-
Output('status-bar', 'children', allow_duplicate=True),
|
230 |
-
Output('document-upload', 'style'),
|
231 |
-
Output('document-choice', 'style'),
|
232 |
-
Output('btn-generate-document', 'style'),
|
233 |
-
[Input(f'btn-{doc_type.lower().replace("_", "-")}', 'n_clicks') for doc_type in document_types.keys()],
|
234 |
-
Input('btn-generate-document', 'n_clicks'),
|
235 |
-
State('document-source', 'value'),
|
236 |
-
State('specific-document-name', 'children'),
|
237 |
-
prevent_initial_call=True
|
238 |
-
)
|
239 |
@app.callback(
|
240 |
Output('document-preview', 'children'),
|
241 |
Output('loading-output', 'children'),
|
|
|
168 |
]))
|
169 |
if existing_files is None:
|
170 |
existing_files = []
|
171 |
+
elif not isinstance(existing_files, list):
|
172 |
+
existing_files = [existing_files]
|
173 |
shredded_document = None # Reset shredded document when new files are uploaded
|
174 |
+
updated_files = existing_files + new_files
|
175 |
+
return updated_files, f"{len(new_files)} document(s) uploaded. Please click 'Shred' to proceed."
|
176 |
+
return dash.no_update, "Please upload a document and click 'Shred' to begin."
|
177 |
+
|
178 |
@app.callback(
|
179 |
Output('file-list', 'children', allow_duplicate=True),
|
180 |
Output('status-bar', 'children', allow_duplicate=True),
|
|
|
226 |
response = model.generate_content(prompt)
|
227 |
return response.text
|
228 |
|
229 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
@app.callback(
|
231 |
Output('document-preview', 'children'),
|
232 |
Output('loading-output', 'children'),
|