Spaces:
Paused
Paused
Update app.py via AI Editor
Browse files
app.py
CHANGED
@@ -139,13 +139,13 @@ def make_shred_controls():
|
|
139 |
|
140 |
def make_tab(tab_id, label):
|
141 |
if tab_id == "shred":
|
142 |
-
#
|
143 |
return dbc.Card(
|
144 |
dbc.CardBody([
|
145 |
make_textarea(tab_id, f"Instructions for {label} (optional)"),
|
|
|
146 |
make_upload(tab_id),
|
147 |
make_shred_doc_preview(),
|
148 |
-
make_shred_controls(),
|
149 |
dcc.Loading(html.Div(id=f'{tab_id}-output'), id="loading", type="default", parent_style={'justifyContent': 'center'}),
|
150 |
dcc.Store(id="shred-upload-store")
|
151 |
]), className="mb-4"
|
@@ -277,7 +277,6 @@ def handle_all_tabs(*args):
|
|
277 |
return outputs
|
278 |
trig = ctx.triggered[0]['prop_id']
|
279 |
logger.info(f"Main callback triggered by {trig}")
|
280 |
-
# Index mapping because Shred tab has custom button IDs
|
281 |
for idx, tab_id in enumerate(tab_cards):
|
282 |
gen_btn = f"{tab_id}-btn.n_clicks"
|
283 |
dl_btn = f"{tab_id}-download-btn.n_clicks"
|
@@ -289,7 +288,6 @@ def handle_all_tabs(*args):
|
|
289 |
prev_output_idx = idx + 3 * n
|
290 |
shred_upload_store_idx = 4 * n
|
291 |
|
292 |
-
# For shred, support the special button IDs
|
293 |
if tab_id == "shred":
|
294 |
shred_gen_btn = "shred-btn.n_clicks"
|
295 |
shred_dl_btn = "shred-download-btn.n_clicks"
|
@@ -329,7 +327,6 @@ def handle_all_tabs(*args):
|
|
329 |
outputs[dl_idx] = dcc.send_bytes(buffer.getvalue(), f"{tab_id}_report.txt")
|
330 |
else:
|
331 |
outputs[dl_idx] = None
|
332 |
-
# All other tabs
|
333 |
if trig == gen_btn:
|
334 |
logger.info(f"Generate button pressed for {tab_id}")
|
335 |
upload = args[upload_idx]
|
|
|
139 |
|
140 |
def make_tab(tab_id, label):
|
141 |
if tab_id == "shred":
|
142 |
+
# Controls right after text area, then upload, then preview, then output
|
143 |
return dbc.Card(
|
144 |
dbc.CardBody([
|
145 |
make_textarea(tab_id, f"Instructions for {label} (optional)"),
|
146 |
+
make_shred_controls(),
|
147 |
make_upload(tab_id),
|
148 |
make_shred_doc_preview(),
|
|
|
149 |
dcc.Loading(html.Div(id=f'{tab_id}-output'), id="loading", type="default", parent_style={'justifyContent': 'center'}),
|
150 |
dcc.Store(id="shred-upload-store")
|
151 |
]), className="mb-4"
|
|
|
277 |
return outputs
|
278 |
trig = ctx.triggered[0]['prop_id']
|
279 |
logger.info(f"Main callback triggered by {trig}")
|
|
|
280 |
for idx, tab_id in enumerate(tab_cards):
|
281 |
gen_btn = f"{tab_id}-btn.n_clicks"
|
282 |
dl_btn = f"{tab_id}-download-btn.n_clicks"
|
|
|
288 |
prev_output_idx = idx + 3 * n
|
289 |
shred_upload_store_idx = 4 * n
|
290 |
|
|
|
291 |
if tab_id == "shred":
|
292 |
shred_gen_btn = "shred-btn.n_clicks"
|
293 |
shred_dl_btn = "shred-download-btn.n_clicks"
|
|
|
327 |
outputs[dl_idx] = dcc.send_bytes(buffer.getvalue(), f"{tab_id}_report.txt")
|
328 |
else:
|
329 |
outputs[dl_idx] = None
|
|
|
330 |
if trig == gen_btn:
|
331 |
logger.info(f"Generate button pressed for {tab_id}")
|
332 |
upload = args[upload_idx]
|