Skip to content

Report object has no attribute save_html function #1595

@Jiadalee

Description

@Jiadalee

I'm using the python 3.12 and evidently 0.7.4 version. I'm running the attached codes below for rendering the testing report html file in the dashboard. Unfortunately, I got the error message showing save_html function is not available in the report object:

AttributeError: 'Report' object has no attribute 'save_html' , However, I do see that this save_html function is available from the official doc.

Any suggestions?

# === 🔟 Monitoring Dashboard ===
st.markdown("---")
st.subheader("📊 Monitoring Dashboard")

if os.path.exists(LOG_FILE):
    # Load logged data
    logged_data = pd.read_csv(LOG_FILE, parse_dates=['timestamp'])

    # Ensure minimal data exists to generate report
    if len(logged_data) >= 3:
        # Reference = first 50 rows, Current = last 50 rows
        reference_data = logged_data.head(50)
        current_data = logged_data.tail(50)

        # Drop empty columns from both datasets
        reference_data = reference_data.dropna(axis=1, how='all')
        current_data = current_data.dropna(axis=1, how='all')

        # Ensure both datasets have the same columns
        common_columns = reference_data.columns.intersection(current_data.columns)
        reference_data = reference_data[common_columns]
        current_data = current_data[common_columns]

        # Generate Evidently report
        report = Report([
            DataDriftPreset(),
            DataSummaryPreset()
        ],
        include_tests=True)
        
        # Run the report (no return value!)  
        report.run(current_data, reference_data)
       
        # Save the report as an HTML file
        report_file = "./evidently_report.html"
        report.save_html(report_file)
 
        # Render the HTML file in Streamlit
        with open(report_file, "r") as f:
            html_content = f.read()
        st.components.v1.html(html_content, height=800)

        with st.expander("🔎 View Logged Data"):
            st.dataframe(logged_data)
    else:
        st.info("Need at least 3 logged predictions to generate monitoring report.")
else:
    st.info("No predictions have been logged yet. Make some predictions to start monitoring.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions