import pandas as pd | |
import pandas_profiling | |
import gradio as gr | |
def generate_report(file): | |
df = pd.read_csv(file) if file.name.endswith(".csv") else pd.read_excel(file) | |
report = pandas_profiling.ProfileReport(df) | |
return report.to_html() | |
iface = gr.Interface( | |
generate_report, | |
[gr.File(accept=".csv,.xlsx", label="Upload a CSV or Excel file")], | |
"html", | |
title="Pandas Profiling Report", | |
live=True, | |
) | |
iface.launch(share=True) |