Spaces:
Sleeping
Sleeping
import gradio as gr | |
import pandas as pd | |
from ydata_profiling import ProfileReport | |
def generate_profile(files_path): | |
dfs = [] | |
for file_path in files_path: | |
if "csv" in file_path: | |
dfs.append(pd.read_csv(file_path)) | |
elif "json" in file_path: | |
dfs.append(pd.read_json(file_path)) | |
elif "pq" in file_path: | |
dfs.append(pd.read_parquet(file_path)) | |
df = pd.concat(dfs, axis=0) | |
profile = ProfileReport(df, title="Profiling Report") | |
profile_html = profile.to_html() | |
return profile_html | |
inputs = gr.Files(file_types=["csv", "pq", "json"], | |
show_label=True, min_width=80) | |
iface = gr.Interface(fn=generate_profile, | |
inputs=inputs, | |
outputs=gr.HTML(), | |
live=True, | |
title="CSV Profiling Tool", | |
description="Upload a CSV file to generate a data profiling report.", | |
) | |
iface.launch() | |