Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,15 +2,24 @@ import pandas as pd
|
|
| 2 |
import ydata_profiling
|
| 3 |
import gradio as gr
|
| 4 |
from pydantic_settings import BaseSettings
|
| 5 |
-
|
| 6 |
-
|
|
|
|
| 7 |
df = pd.read_csv(file) if file.name.endswith(".csv") else pd.read_excel(file)
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
iface = gr.Interface(
|
| 12 |
generate_report,
|
| 13 |
-
[gr.File(file_types=['.csv','.xlsx'], label="Upload a CSV or Excel file")
|
|
|
|
| 14 |
"html",
|
| 15 |
title="Pandas Profiling Report",
|
| 16 |
live=True,
|
|
|
|
| 2 |
import ydata_profiling
|
| 3 |
import gradio as gr
|
| 4 |
from pydantic_settings import BaseSettings
|
| 5 |
+
from pandasgui import show
|
| 6 |
+
import sweetviz as sv
|
| 7 |
+
def generate_report(file,type):
|
| 8 |
df = pd.read_csv(file) if file.name.endswith(".csv") else pd.read_excel(file)
|
| 9 |
+
if type == "pandas profiling":
|
| 10 |
+
return ydata_profiling.ProfileReport(df).to_html()
|
| 11 |
+
elif type == "pandasGUI":
|
| 12 |
+
return show(df)
|
| 13 |
+
elif type == "sweetviz":
|
| 14 |
+
return sv.analyze(global_df).show_html()
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
|
| 19 |
iface = gr.Interface(
|
| 20 |
generate_report,
|
| 21 |
+
[gr.File(file_types=['.csv','.xlsx'], label="Upload a CSV or Excel file"),
|
| 22 |
+
gr.Radio(["pandas profiling", "pandasGUI", "sweetviz"], label="Type of report", info="Explore the data")],
|
| 23 |
"html",
|
| 24 |
title="Pandas Profiling Report",
|
| 25 |
live=True,
|