Update app.py
Browse files
app.py
CHANGED
|
@@ -39,34 +39,6 @@ app.layout = html.Div([
|
|
| 39 |
html.Div(id='output')
|
| 40 |
])
|
| 41 |
|
| 42 |
-
@app.callback(
|
| 43 |
-
Output('input-container', 'children'),
|
| 44 |
-
Input('input-method', 'value')
|
| 45 |
-
)
|
| 46 |
-
def update_input(input_method):
|
| 47 |
-
if input_method == 'upload':
|
| 48 |
-
return dcc.Upload(
|
| 49 |
-
id='upload-file',
|
| 50 |
-
children=html.Div(['Drag and Drop or ', html.A('Select Files')]),
|
| 51 |
-
style={
|
| 52 |
-
'width': '100%',
|
| 53 |
-
'height': '60px',
|
| 54 |
-
'lineHeight': '60px',
|
| 55 |
-
'borderWidth': '1px',
|
| 56 |
-
'borderStyle': 'dashed',
|
| 57 |
-
'borderRadius': '5px',
|
| 58 |
-
'textAlign': 'center',
|
| 59 |
-
'margin': '10px'
|
| 60 |
-
},
|
| 61 |
-
multiple=False
|
| 62 |
-
)
|
| 63 |
-
else:
|
| 64 |
-
return dcc.Textarea(
|
| 65 |
-
id='markdown-text',
|
| 66 |
-
placeholder='Enter or paste your markdown text here',
|
| 67 |
-
style={'width': '100%', 'height': 300}
|
| 68 |
-
)
|
| 69 |
-
|
| 70 |
def markdown_to_pptx(md_text):
|
| 71 |
prs = Presentation()
|
| 72 |
slides = re.split(r'# Slide \d+:', md_text)
|
|
@@ -106,7 +78,6 @@ def markdown_to_pptx(md_text):
|
|
| 106 |
@app.callback(
|
| 107 |
Output('output', 'children'),
|
| 108 |
Input('convert-button', 'n_clicks'),
|
| 109 |
-
State('input-method', 'value'),
|
| 110 |
State('upload-file', 'contents'),
|
| 111 |
State('markdown-text', 'value')
|
| 112 |
)
|
|
@@ -131,6 +102,6 @@ def convert_markdown(n_clicks, file_contents, markdown_text):
|
|
| 131 |
download='output.pptx'
|
| 132 |
)
|
| 133 |
])
|
| 134 |
-
|
| 135 |
if __name__ == '__main__':
|
| 136 |
app.run(host='0.0.0.0', port=7860, debug=True)
|
|
|
|
| 39 |
html.Div(id='output')
|
| 40 |
])
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
def markdown_to_pptx(md_text):
|
| 43 |
prs = Presentation()
|
| 44 |
slides = re.split(r'# Slide \d+:', md_text)
|
|
|
|
| 78 |
@app.callback(
|
| 79 |
Output('output', 'children'),
|
| 80 |
Input('convert-button', 'n_clicks'),
|
|
|
|
| 81 |
State('upload-file', 'contents'),
|
| 82 |
State('markdown-text', 'value')
|
| 83 |
)
|
|
|
|
| 102 |
download='output.pptx'
|
| 103 |
)
|
| 104 |
])
|
| 105 |
+
|
| 106 |
if __name__ == '__main__':
|
| 107 |
app.run(host='0.0.0.0', port=7860, debug=True)
|