File size: 991 Bytes
078e7b1
4ac93ee
 
078e7b1
 
4ac93ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4d03a93
 
4ac93ee
 
 
 
 
 
 
 
078e7b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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()