arad1367 commited on
Commit
56346ea
Β·
verified Β·
1 Parent(s): da3f624

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -52
app.py CHANGED
@@ -1,52 +1,52 @@
1
- import pandas as pd
2
- from ydata_profiling import ProfileReport
3
- import gradio as gr
4
-
5
- def generate_report(file):
6
- try:
7
- # Read the uploaded CSV file
8
- df = pd.read_csv(file.name)
9
-
10
- # Generate the profiling report
11
- report = ProfileReport(df, title="Data Report", explorative=True)
12
-
13
- # Render the report as an HTML string
14
- report_html = report.to_html()
15
-
16
- return report_html
17
- except Exception as e:
18
- return f"An error occurred: {str(e)}"
19
-
20
- # Define the footer HTML content
21
- footer = """
22
- <div style="text-align: center; margin-top: 20px;">
23
- <a href="https://www.linkedin.com/in/pejman-ebrahimi-4a60151a7/" target="_blank">LinkedIn</a> |
24
- <a href="https://github.com/arad1367" target="_blank">GitHub</a> |
25
- <a href="https://arad1367.pythonanywhere.com/" target="_blank">Live demo of my PhD defense</a>
26
- <br>
27
- Made with πŸ’– by Pejman Ebrahimi
28
- </div>
29
- """
30
-
31
- # Create a Gradio interface with custom layout
32
- with gr.Blocks(theme='bethecloud/storj_theme') as app:
33
- gr.Markdown("# Data Report Generator")
34
-
35
- # File input section
36
- with gr.Row():
37
- with gr.Column(scale=1):
38
- upload = gr.File(label="Upload your CSV file")
39
- with gr.Column(scale=1):
40
- generate_btn = gr.Button("Generate Report")
41
-
42
- # Output section for displaying the report
43
- report_output = gr.HTML()
44
-
45
- # Action to generate and display the report
46
- generate_btn.click(fn=generate_report, inputs=upload, outputs=report_output)
47
-
48
- # Add the footer to the app
49
- gr.HTML(footer)
50
-
51
- # Launch the Gradio app
52
- app.launch()
 
1
+ import pandas as pd
2
+ from ydata_profiling import ProfileReport
3
+ import gradio as gr
4
+
5
+ def generate_report(file):
6
+ try:
7
+ # Read the uploaded CSV file
8
+ df = pd.read_csv(file.name)
9
+
10
+ # Generate the profiling report
11
+ report = ProfileReport(df, title="Data Report", explorative=True)
12
+
13
+ # Render the report as an HTML string
14
+ report_html = report.to_html()
15
+
16
+ return report_html
17
+ except Exception as e:
18
+ return f"An error occurred: {str(e)}"
19
+
20
+ # Define the footer HTML content
21
+ footer = """
22
+ <div style="text-align: center; margin-top: 20px;">
23
+ <a href="https://www.linkedin.com/in/pejman-ebrahimi-4a60151a7/" target="_blank">LinkedIn</a> |
24
+ <a href="https://github.com/arad1367" target="_blank">GitHub</a> |
25
+ <a href="https://arad1367.pythonanywhere.com/" target="_blank">Live demo of my PhD defense</a>
26
+ <br>
27
+ Made with πŸ’– by Pejman Ebrahimi
28
+ </div>
29
+ """
30
+
31
+ # Create a Gradio interface with custom layout
32
+ with gr.Blocks() as app:
33
+ gr.Markdown("# Data Report Generator")
34
+
35
+ # File input section
36
+ with gr.Row():
37
+ with gr.Column(scale=1):
38
+ upload = gr.File(label="Upload your CSV file")
39
+ with gr.Column(scale=1):
40
+ generate_btn = gr.Button("Generate Report")
41
+
42
+ # Output section for displaying the report
43
+ report_output = gr.HTML()
44
+
45
+ # Action to generate and display the report
46
+ generate_btn.click(fn=generate_report, inputs=upload, outputs=report_output)
47
+
48
+ # Add the footer to the app
49
+ gr.HTML(footer)
50
+
51
+ # Launch the Gradio app
52
+ app.launch()