Update main.py
Browse files
main.py
CHANGED
@@ -55,10 +55,13 @@ async def upload_file(file: UploadFile = File(...)):
|
|
55 |
total_requests=logs_df.shape[0],
|
56 |
redundant_requests=ip_address_count_df.shape[0],
|
57 |
redundant_percentage=(ip_address_count_df.shape[0] / logs_df.shape[0]) * 100,
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
62 |
)
|
63 |
|
64 |
# # Save result in a new HTML file
|
|
|
55 |
total_requests=logs_df.shape[0],
|
56 |
redundant_requests=ip_address_count_df.shape[0],
|
57 |
redundant_percentage=(ip_address_count_df.shape[0] / logs_df.shape[0]) * 100,
|
58 |
+
dataframe_html = (
|
59 |
+
ip_address_count_df.head(1000)
|
60 |
+
.style.background_gradient(subset=['count', 'perc', 'cum_perc'], cmap='cividis')
|
61 |
+
.format({'count': '{:,}', 'perc': '{:.1%}', 'cum_perc': '{:.1%}'})
|
62 |
+
.render()
|
63 |
+
.replace('\n', '') # Remove newline characters to format the HTML properly
|
64 |
+
)
|
65 |
)
|
66 |
|
67 |
# # Save result in a new HTML file
|