'How to print out Model Summary in Plotly Dash?

Say I build an ARIMA model and I would like to display the model summary on dash exactly as in python, how can I do so? The following is an example code. (I am using colab therefore app = JupyterDash() )

import yfinance as yf
import dash
import dash_html_components as HTML
from statsmodels.tsa.arima_model import ARIMA

app = JupyterDash() 

data = yf.download("AAPL", start="2017-01-01", end="2021-12-31")

arima = ARIMA(data["Close"], order=(1, 1, 1)).fit(disp=0)

arima.summary()

app.layout = html.Div([
    html.P(arima.summary()) #what should I type here?
])

app.run_server(host='0.0.0.0', debug=True, port=50800)

With the help of Daniel Al Mouiee, the following code get closer to the output in python.

summary = arima.summary()

app.layout = html.Div([
    html.P(str(summary), style={'whiteSpace': 'pre-wrap'})
])


Solution 1:[1]

Try converting the summary to a string and placing that in the div:

summary = arima.summary()

app.layout = html.Div([
    html.P(str(summary))
])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1