Update app.py via AI Editor
Browse files
app.py
CHANGED
|
@@ -101,16 +101,9 @@ app.layout = html.Div([
|
|
| 101 |
className="mb-3"
|
| 102 |
),
|
| 103 |
html.Div(id="upload-file-name", className="text-muted"),
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
children=[
|
| 108 |
-
dbc.Button("Generate Slides", id='generate-button', color="primary", className="w-100 mt-3", size="lg"),
|
| 109 |
-
html.Div(id='log-output', style={'whiteSpace': 'pre-line', 'height': '200px', 'overflowY': 'scroll', 'border': '1px solid #ddd', 'padding': '10px', 'marginTop': '10px'}),
|
| 110 |
-
html.Div(id='progress-output', className="mt-2"),
|
| 111 |
-
],
|
| 112 |
-
style={'width': '100%'}
|
| 113 |
-
),
|
| 114 |
])
|
| 115 |
], className="mb-4 shadow-sm")
|
| 116 |
], md=6),
|
|
@@ -171,7 +164,7 @@ def generate_image_prompt(slide_content, session_id):
|
|
| 171 |
prompt = f"""
|
| 172 |
Based on the following slide content, create a detailed prompt for generating
|
| 173 |
an image that represents the main idea of the slide. The image should be
|
| 174 |
-
suitable for a professional presentation
|
| 175 |
|
| 176 |
{slide_content}
|
| 177 |
Image prompt:
|
|
@@ -298,7 +291,6 @@ def unified_callback(gen_btn, gen_ppt_btn, file_contents, document_text, slides_
|
|
| 298 |
if not ctx.triggered or not session_id:
|
| 299 |
raise PreventUpdate
|
| 300 |
button_id = ctx.triggered[0]['prop_id'].split('.')[0]
|
| 301 |
-
# Slide generation logic
|
| 302 |
if button_id == 'generate-button':
|
| 303 |
decoded_file_text = None
|
| 304 |
if file_contents:
|
|
@@ -343,7 +335,6 @@ def unified_callback(gen_btn, gen_ppt_btn, file_contents, document_text, slides_
|
|
| 343 |
with session['lock']:
|
| 344 |
log_str = '\n'.join(session['log_messages'][:100])
|
| 345 |
return f"An error occurred: {str(e)}", True, log_str
|
| 346 |
-
# PowerPoint generation logic
|
| 347 |
elif button_id == 'generate-ppt-button':
|
| 348 |
if gen_ppt_btn is None or not slides_content or not session_id:
|
| 349 |
raise PreventUpdate
|
|
|
|
| 101 |
className="mb-3"
|
| 102 |
),
|
| 103 |
html.Div(id="upload-file-name", className="text-muted"),
|
| 104 |
+
dbc.Button("Generate Slides", id='generate-button', color="primary", className="w-100 mt-3", size="lg"),
|
| 105 |
+
html.Div(id='log-output', style={'whiteSpace': 'pre-line', 'height': '200px', 'overflowY': 'scroll', 'border': '1px solid #ddd', 'padding': '10px', 'marginTop': '10px'}),
|
| 106 |
+
html.Div(id='progress-output', className="mt-2"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
])
|
| 108 |
], className="mb-4 shadow-sm")
|
| 109 |
], md=6),
|
|
|
|
| 164 |
prompt = f"""
|
| 165 |
Based on the following slide content, create a detailed prompt for generating
|
| 166 |
an image that represents the main idea of the slide. The image should be
|
| 167 |
+
suitable for a professional presentation. NEVER NEVER HAVE ANY FORM OF TEXT OR WORDS IN THE IMAGE.
|
| 168 |
|
| 169 |
{slide_content}
|
| 170 |
Image prompt:
|
|
|
|
| 291 |
if not ctx.triggered or not session_id:
|
| 292 |
raise PreventUpdate
|
| 293 |
button_id = ctx.triggered[0]['prop_id'].split('.')[0]
|
|
|
|
| 294 |
if button_id == 'generate-button':
|
| 295 |
decoded_file_text = None
|
| 296 |
if file_contents:
|
|
|
|
| 335 |
with session['lock']:
|
| 336 |
log_str = '\n'.join(session['log_messages'][:100])
|
| 337 |
return f"An error occurred: {str(e)}", True, log_str
|
|
|
|
| 338 |
elif button_id == 'generate-ppt-button':
|
| 339 |
if gen_ppt_btn is None or not slides_content or not session_id:
|
| 340 |
raise PreventUpdate
|