merve HF staff commited on
Commit
ab3118d
1 Parent(s): 44de84c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -15,6 +15,7 @@ dataset_name = gr.Textbox(label = "Dataset Name")
15
  dataset = gr.File(label = "Dataset")
16
  output_text = gr.Textbox(label = "Status")
17
 
 
18
  def profile_dataset(dataset, username, token, dataset_name):
19
 
20
  df = pd.read_csv(dataset.name)
@@ -22,12 +23,13 @@ def profile_dataset(dataset, username, token, dataset_name):
22
 
23
  repo_url = create_repo(f"{username}/{dataset_name}", repo_type = "space", token = token, space_sdk = "static", private=False)
24
 
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
-
29
-
30
-
 
 
31
  return f"Your dataset report will be ready at {repo_url}"
32
 
33
- gr.Interface(profile_dataset, title = title, description = description, inputs = [dataset, username, token, dataset_name], outputs=[output_text], enable_queue = True).launch(debug=True)
 
15
  dataset = gr.File(label = "Dataset")
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)
 
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:
30
+ f.write(readme)
31
+ upload_file(path_or_fileobj ="./README.md", path_in_repo = "README.md", repo_id =f"{username}/{dataset_name}", repo_type = "space", token=token)
32
+
33
  return f"Your dataset report will be ready at {repo_url}"
34
 
35
+ gr.Interface(profile_dataset, title = title, description = description, inputs = [dataset, username, token, dataset_name], outputs=[output_text], enable_queue = True).launch(debug=True)