large dataset fix
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import subprocess
|
|
7 |
import os
|
8 |
import tempfile
|
9 |
|
10 |
-
description = "This Space will profile a dataset file that you drag and drop and push the profile report to your Hugging Face account. π The value in dataset name field you'll enter will be used in the namespace of the Space that will be pushed to your profile, so you can use it to version the reports too! ππ» Feel free to open a discussion in case you have any feature requests. Dataset name you'll enter will be used for repository name so make sure it doesn't exist and it doesn't contain spaces."
|
11 |
title = "Dataset Profiler πͺβ¨"
|
12 |
token = gr.Textbox(label = "Your Hugging Face Token")
|
13 |
username = gr.Textbox(label = "Your Hugging Face User Name")
|
@@ -17,13 +17,16 @@ output_text = gr.Textbox(label = "Status")
|
|
17 |
|
18 |
|
19 |
def profile_dataset(dataset, username, token, dataset_name):
|
20 |
-
|
21 |
df = pd.read_csv(dataset.name)
|
22 |
-
|
|
|
|
|
|
|
23 |
|
24 |
repo_url = create_repo(f"{username}/{dataset_name}", repo_type = "space", token = token, space_sdk = "static", private=False)
|
25 |
|
26 |
profile.to_file("./index.html")
|
|
|
27 |
upload_file(path_or_fileobj ="./index.html", path_in_repo = "index.html", repo_id =f"{username}/{dataset_name}", repo_type = "space", token=token)
|
28 |
readme = f"---\ntitle: {dataset_name}\nemoji: β¨\ncolorFrom: green\ncolorTo: red\nsdk: static\npinned: false\ntags:\n- dataset-report\n---"
|
29 |
with open("README.md", "w+") as f:
|
|
|
7 |
import os
|
8 |
import tempfile
|
9 |
|
10 |
+
description = "This Space will profile a dataset file that you drag and drop and push the profile report to your Hugging Face account. π The value in dataset name field you'll enter will be used in the namespace of the Space that will be pushed to your profile, so you can use it to version the reports too! ππ» Feel free to open a discussion in case you have any feature requests. Dataset name you'll enter will be used for repository name so make sure it doesn't exist and it doesn't contain spaces. If your dataset has 15 or more columns, it will generate a minimal report."
|
11 |
title = "Dataset Profiler πͺβ¨"
|
12 |
token = gr.Textbox(label = "Your Hugging Face Token")
|
13 |
username = gr.Textbox(label = "Your Hugging Face User Name")
|
|
|
17 |
|
18 |
|
19 |
def profile_dataset(dataset, username, token, dataset_name):
|
|
|
20 |
df = pd.read_csv(dataset.name)
|
21 |
+
if len(df.columns) <= 15:
|
22 |
+
profile = pp.ProfileReport(df, title=f"{dataset_name} Report")
|
23 |
+
else:
|
24 |
+
profile = pp.ProfileReport(df, title=f"{dataset_name} Report", minimal = True)
|
25 |
|
26 |
repo_url = create_repo(f"{username}/{dataset_name}", repo_type = "space", token = token, space_sdk = "static", private=False)
|
27 |
|
28 |
profile.to_file("./index.html")
|
29 |
+
|
30 |
upload_file(path_or_fileobj ="./index.html", path_in_repo = "index.html", repo_id =f"{username}/{dataset_name}", repo_type = "space", token=token)
|
31 |
readme = f"---\ntitle: {dataset_name}\nemoji: β¨\ncolorFrom: green\ncolorTo: red\nsdk: static\npinned: false\ntags:\n- dataset-report\n---"
|
32 |
with open("README.md", "w+") as f:
|