tonne commited on
Commit
4ac93ee
1 Parent(s): 078e7b1

Profile report

Browse files
Files changed (3) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. app.py +27 -3
  3. requirements.txt +3 -0
__pycache__/app.cpython-311.pyc ADDED
Binary file (1.65 kB). View file
 
app.py CHANGED
@@ -1,7 +1,31 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  iface.launch()
 
1
  import gradio as gr
2
+ import pandas as pd
3
+ from ydata_profiling import ProfileReport
4
 
 
 
5
 
6
+ def generate_profile(files_path):
7
+ dfs = []
8
+ for file_path in files_path:
9
+ if "csv" in file_path:
10
+ dfs.append(pd.read_csv(file_path))
11
+ elif "json" in file_path:
12
+ dfs.append(pd.read_json(file_path))
13
+ elif "pq" in file_path:
14
+ dfs.append(pd.read_parquet(file_path))
15
+
16
+ df = pd.concat(dfs, axis=0)
17
+ profile = ProfileReport(df, title="Profiling Report")
18
+ profile_html = profile.to_html()
19
+ return profile_html
20
+
21
+
22
+ inputs = gr.Files(file_types=["csv", "pq", "json"], show_label=True)
23
+
24
+ iface = gr.Interface(fn=generate_profile,
25
+ inputs=inputs,
26
+ outputs=gr.HTML(),
27
+ live=True,
28
+ title="CSV Profiling Tool",
29
+ description="Upload a CSV file to generate a data profiling report.",
30
+ )
31
  iface.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ pandas
2
+ ydata_profiling
3
+ ipywidgets