File size: 1,262 Bytes
0a5d39a
7a75289
0a5d39a
71c9026
c1d9e7e
1065d81
 
0a5d39a
1065d81
 
25cd492
1065d81
f06c07a
 
 
1065d81
 
 
0a5d39a
15a4a02
0a5d39a
1065d81
25cd492
489ab09
25cd492
0a5d39a
 
 
15a4a02
 
 
 
 
 
 
 
 
 
 
 
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
34
35
36
37
38
39
40
import pandas as pd
import ydata_profiling
import gradio as gr
from pydantic_settings import BaseSettings

import sweetviz as sv
def generate_report(file,type):
    df = pd.read_csv(file) if file.name.endswith(".csv") else pd.read_excel(file)
    if type == "pandas profiling":
        return  ydata_profiling.ProfileReport(df).to_html()
 
    elif type == "sweetviz":
        return sv.analyze(df).show_html(open_browser=True, 
            layout='widescreen', 
            scale=None)
    

   

profile = gr.Interface(
    generate_report,
    [gr.File(file_types=['.csv','.xlsx'], label="Upload a CSV or Excel file"),
     gr.Radio(["pandas profiling", "sweetviz"], label="Type of report", info="Explore the data")],
    gr.HTML(label="Data profile Report"),
    title="Excel sheet Profiling Report",
    live=True,
)

cluster = gr.Interface(
    generate_report,
    [gr.File(file_types=['.csv','.xlsx'], label="Upload a CSV or Excel file"),
     gr.Radio(["pandas profiling", "sweetviz"], label="Type of report", info="Explore the data")],
    gr.HTML(label="Data profile Report"),
    title="Excel sheet Profiling Report",
    live=True,
)

demo = gr.TabbedInterface([cluster, profile], ["Product clustering", "Data Exploration"])

demo.launch(share=True)