Having issues embedding powerpoint into my Dash app -- embedding powerpoint -- Please help!

from dash import Dash , html , dcc , Input , Output , State , no_update
import pandas as pd
import base64
from PIL import Image
import dash_bootstrap_components as dbc
from pptx import Presentation
import io
 

date_data = pd.read_csv( "dates_data.csv" )

app = Dash( __name__ )
server = app.server


#############################
 
slides_item = html.Div(
    [
        html.Div(
            html.Div(
                [
                    html.Div( [
                            html.H5(
                            'Slides' ,
                            style={
                                'backgroundColor': 'white' ,
                                'fontFamily': 'verdana' ,
                                # 'textAlign':'center',
                                'gridArea': "slide_header"

                                }
                            ) ,
                        html.A("Download PPT",href="/download_ppt/")    ,
                        # using the pillow image variable

                        ], id='excel' ) ,
                    html.Div( className="sidebar-wrapper" ) ,
                    ]
                ) ,
            className="sidebar" ,
            ) ,
        html.Div(
            html.Div(
                html.Div( className="container-fluid" ) ,
                className="navbar navbar-expand-lg navbar-transparent navbar-absolute fixed-top " ,
                ) ,
            className="main-panel" ,
            ) ,
        ] , id="slides_id"
    )
slides_item.style = {'gridArea': "slides_ga"}




 app.layout = html.Div( [
      dbc.Row ( [dbc.Col(slides_item, width=11)], justify="around"),


 #call;backs area
##############################

@app.server.route("/download_ppt/")
def download_ppt():
    #if path.exists( "Presentation1.pptx" ):
        with open(r'Presentation1.pptx') as f:
            source = f.read()
        prs=Presentation('Presentation1.pptx')
        f.close()
        filename = io.StringIO()
        prs.save(filename)
        filename.seek(0)
        return send_file(
            filename,
            mimetype='application/vnd.openxmlformats-officedocument.presentationml.presentation',
            attachment_filename="Presentation1.pptx",
            as_attachment=True,

            )




@app.callback(
    Output( "pred-graph" , "figure" ) ,
    Input( "pred-table-tabs" , "value" )
    )
def change_pred_graph(group):
    if group == "predsatisfied":
        return return_type_prediction_subplots( Pred_Satisfied_df , 4 )
    elif group == "predhigh_maint":
        return return_type_prediction_subplots( Pred_High_Maintenance_df , 0 )
    elif group == "preddissatisfied":
        return return_type_prediction_subplots( Pred_dissatisfied_df , 1 )
    elif group == "predloyalist":
        return return_type_prediction_subplots( Pred_Loyalist_df , 3 )
    else:
        return return_type_prediction_subplots( Pred_Potential_Loyalist_df , 2 )
ERROR:

# UnicodeDecodeError

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 640: character maps to <undefined>

## Traceback *(most recent call last)*

* #### File "C:\Users\Everydayuse\PycharmProjects\new_capstone_01\env\lib\site-packages\flask\app.py", line *1823*, in `full_dispatch_request`

rv = self.dispatch_request()

* #### File "C:\Users\Everydayuse\PycharmProjects\new_capstone_01\env\lib\site-packages\flask\app.py", line *1799*, in `dispatch_request`

return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)

* #### File "C:\Users\Everydayuse\PycharmProjects\mfrancis_capstone\src\app.py", line *1947*, in `download_ppt`

source = f.read()

* #### File "C:\Users\Everydayuse\AppData\Local\Programs\Python\Python39\lib\encodings\cp1252.py", line *23*, in `decode`

return codecs.charmap_decode(input,self.errors,decoding_table)[0]

> UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 640: character maps to <undefined>

The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.

To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

* `dump()` shows all variables in the frame
* `dump(obj)` dumps all that's known about the object

HI @marlainna456 could you please format your code for better readability?

I am so sorry about the format. I tried to format it but it still come out bad… so sorry