Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -34,8 +34,8 @@ app.layout = dbc.Container([
|
|
34 |
accept='.docx,.pdf'
|
35 |
),
|
36 |
html.Div(id='upload-output'),
|
37 |
-
|
38 |
-
|
39 |
dbc.Button("Convert and Download", id="convert-button", color="primary", className="mt-3", disabled=True),
|
40 |
dcc.Download(id="download-zip")
|
41 |
])
|
@@ -82,8 +82,10 @@ def process_files(contents, filenames):
|
|
82 |
@app.callback(
|
83 |
[Output('upload-output', 'children'),
|
84 |
Output('convert-button', 'disabled'),
|
85 |
-
Output('upload-
|
86 |
-
Output('
|
|
|
|
|
87 |
Output('download-zip', 'data')],
|
88 |
[Input('upload-data', 'contents'),
|
89 |
Input('upload-data', 'filename'),
|
@@ -104,7 +106,7 @@ def update_output(list_of_contents, list_of_names, n_clicks, contents, filenames
|
|
104 |
html.Hr()
|
105 |
]) for name in list_of_names
|
106 |
]
|
107 |
-
return children, False, {"display": "
|
108 |
return no_update
|
109 |
|
110 |
if ctx.triggered[0]['prop_id'] == 'convert-button.n_clicks':
|
@@ -115,7 +117,15 @@ def update_output(list_of_contents, list_of_names, n_clicks, contents, filenames
|
|
115 |
zip_data = process_files(contents, filenames)
|
116 |
return dcc.send_bytes(zip_data, "converted_files.zip")
|
117 |
|
118 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
return no_update
|
121 |
|
|
|
34 |
accept='.docx,.pdf'
|
35 |
),
|
36 |
html.Div(id='upload-output'),
|
37 |
+
html.Div(id="upload-status", style={"display": "none"}),
|
38 |
+
html.Div(id="conversion-status", style={"display": "none"}),
|
39 |
dbc.Button("Convert and Download", id="convert-button", color="primary", className="mt-3", disabled=True),
|
40 |
dcc.Download(id="download-zip")
|
41 |
])
|
|
|
82 |
@app.callback(
|
83 |
[Output('upload-output', 'children'),
|
84 |
Output('convert-button', 'disabled'),
|
85 |
+
Output('upload-status', 'children'),
|
86 |
+
Output('upload-status', 'style'),
|
87 |
+
Output('conversion-status', 'children'),
|
88 |
+
Output('conversion-status', 'style'),
|
89 |
Output('download-zip', 'data')],
|
90 |
[Input('upload-data', 'contents'),
|
91 |
Input('upload-data', 'filename'),
|
|
|
106 |
html.Hr()
|
107 |
]) for name in list_of_names
|
108 |
]
|
109 |
+
return children, False, "Files uploaded successfully", {"display": "block"}, "", {"display": "none"}, None
|
110 |
return no_update
|
111 |
|
112 |
if ctx.triggered[0]['prop_id'] == 'convert-button.n_clicks':
|
|
|
117 |
zip_data = process_files(contents, filenames)
|
118 |
return dcc.send_bytes(zip_data, "converted_files.zip")
|
119 |
|
120 |
+
return (
|
121 |
+
no_update,
|
122 |
+
True,
|
123 |
+
"",
|
124 |
+
{"display": "none"},
|
125 |
+
"Converting files... This may take a moment.",
|
126 |
+
{"display": "block"},
|
127 |
+
process_and_download()
|
128 |
+
)
|
129 |
|
130 |
return no_update
|
131 |
|