Update app.py
Browse files
app.py
CHANGED
|
@@ -7,52 +7,69 @@ import re
|
|
| 7 |
from pptx import Presentation
|
| 8 |
from pptx.util import Inches, Pt
|
| 9 |
|
| 10 |
-
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
|
| 11 |
|
| 12 |
-
app.layout =
|
| 13 |
-
dbc.
|
| 14 |
-
dbc.
|
| 15 |
-
html.H1("
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
])
|
| 43 |
-
], md=6)
|
| 44 |
-
]),
|
| 45 |
-
dbc.Row([
|
| 46 |
-
dbc.Col([
|
| 47 |
-
dbc.Button("Convert", id='convert-button', color="success", className="mt-3 mb-3 w-100")
|
| 48 |
-
])
|
| 49 |
-
]),
|
| 50 |
-
dbc.Row([
|
| 51 |
-
dbc.Col([
|
| 52 |
-
html.Div(id='output')
|
| 53 |
])
|
| 54 |
-
])
|
| 55 |
-
]
|
| 56 |
|
| 57 |
def markdown_to_pptx(md_text):
|
| 58 |
prs = Presentation()
|
|
|
|
| 7 |
from pptx import Presentation
|
| 8 |
from pptx.util import Inches, Pt
|
| 9 |
|
| 10 |
+
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP, 'https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap'])
|
| 11 |
|
| 12 |
+
app.layout = html.Div([
|
| 13 |
+
dbc.Navbar(
|
| 14 |
+
dbc.Container(
|
| 15 |
+
html.H1("MD to PPT", className="mb-0 text-white")
|
| 16 |
+
),
|
| 17 |
+
color="primary",
|
| 18 |
+
dark=True,
|
| 19 |
+
fixed="top",
|
| 20 |
+
className="mb-5",
|
| 21 |
+
),
|
| 22 |
+
dbc.Container([
|
| 23 |
+
dbc.Row([
|
| 24 |
+
dbc.Col([
|
| 25 |
+
dbc.Card([
|
| 26 |
+
dbc.CardHeader("Upload Markdown", className="bg-primary text-white"),
|
| 27 |
+
dbc.CardBody([
|
| 28 |
+
dcc.Upload(
|
| 29 |
+
id='upload-file',
|
| 30 |
+
children=html.Div([
|
| 31 |
+
html.I(className="fas fa-cloud-upload-alt fa-3x mb-3"),
|
| 32 |
+
html.Div("Drag and Drop or Select File")
|
| 33 |
+
], className="text-center"),
|
| 34 |
+
style={
|
| 35 |
+
'borderWidth': '2px',
|
| 36 |
+
'borderStyle': 'dashed',
|
| 37 |
+
'borderRadius': '5px',
|
| 38 |
+
'padding': '20px',
|
| 39 |
+
'transition': 'border .3s ease-in-out'
|
| 40 |
+
},
|
| 41 |
+
className="mb-3"
|
| 42 |
+
),
|
| 43 |
+
html.Div(id="upload-file-name", className="text-muted")
|
| 44 |
+
])
|
| 45 |
+
], className="mb-4 shadow-sm")
|
| 46 |
+
], md=6, className="mb-4"),
|
| 47 |
+
dbc.Col([
|
| 48 |
+
dbc.Card([
|
| 49 |
+
dbc.CardHeader("Paste Markdown", className="bg-primary text-white"),
|
| 50 |
+
dbc.CardBody([
|
| 51 |
+
dbc.Textarea(
|
| 52 |
+
id='markdown-text',
|
| 53 |
+
placeholder='Enter or paste your markdown text here',
|
| 54 |
+
style={'height': '200px'},
|
| 55 |
+
className="mb-3"
|
| 56 |
+
)
|
| 57 |
+
])
|
| 58 |
+
], className="mb-4 shadow-sm")
|
| 59 |
+
], md=6, className="mb-4")
|
| 60 |
+
]),
|
| 61 |
+
dbc.Row([
|
| 62 |
+
dbc.Col([
|
| 63 |
+
dbc.Button("Convert", id='convert-button', color="success", className="w-100 mb-3", size="lg")
|
| 64 |
+
])
|
| 65 |
+
]),
|
| 66 |
+
dbc.Row([
|
| 67 |
+
dbc.Col([
|
| 68 |
+
html.Div(id='output')
|
| 69 |
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
])
|
| 71 |
+
], className="mt-5 pt-5")
|
| 72 |
+
])
|
| 73 |
|
| 74 |
def markdown_to_pptx(md_text):
|
| 75 |
prs = Presentation()
|