Commit
•
c335d03
1
Parent(s):
ac4bac2
Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@ import gradio as gr
|
|
4 |
from pydantic_settings import BaseSettings
|
5 |
from tempfile import NamedTemporaryFile
|
6 |
import sweetviz as sv
|
7 |
-
|
8 |
-
|
9 |
|
10 |
def generate_report(file, type):
|
11 |
df = pd.read_csv(file) if file.name.endswith(".csv") else pd.read_excel(file)
|
@@ -39,8 +39,14 @@ def generate_report(file, type):
|
|
39 |
temp_file3 = NamedTemporaryFile(delete=False, suffix=".html")
|
40 |
temp_file3.write(contents.encode('utf-8'))
|
41 |
temp_file3.close()
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
|
46 |
with gr.Blocks() as cluster:
|
@@ -59,5 +65,7 @@ with gr.Blocks() as cluster:
|
|
59 |
out2=gr.File(label="Download CSV")
|
60 |
gr.HTML(value="""<h1 style="color: #3399FF; text-shadow: 1px 1px 2px #ddd;">SWEETVIZ REPORT</h1>""")
|
61 |
out3=gr.File(label="Download CSV")
|
62 |
-
|
|
|
|
|
63 |
cluster.launch()
|
|
|
4 |
from pydantic_settings import BaseSettings
|
5 |
from tempfile import NamedTemporaryFile
|
6 |
import sweetviz as sv
|
7 |
+
from datatile.summary.df import DataFrameSummary
|
8 |
+
|
9 |
|
10 |
def generate_report(file, type):
|
11 |
df = pd.read_csv(file) if file.name.endswith(".csv") else pd.read_excel(file)
|
|
|
39 |
temp_file3 = NamedTemporaryFile(delete=False, suffix=".html")
|
40 |
temp_file3.write(contents.encode('utf-8'))
|
41 |
temp_file3.close()
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
dfs = DataFrameSummary(df)
|
48 |
+
|
49 |
+
return temp_file1.name ,temp_file3.name ,dfs.summary()
|
50 |
|
51 |
|
52 |
with gr.Blocks() as cluster:
|
|
|
65 |
out2=gr.File(label="Download CSV")
|
66 |
gr.HTML(value="""<h1 style="color: #3399FF; text-shadow: 1px 1px 2px #ddd;">SWEETVIZ REPORT</h1>""")
|
67 |
out3=gr.File(label="Download CSV")
|
68 |
+
with gr.Row():
|
69 |
+
dataframe=gr.Dataframe()
|
70 |
+
btn.click(generate_report,inputs=[file],outputs=[out1,out3,dataframe])
|
71 |
cluster.launch()
|