merve HF staff commited on
Commit
5d3f533
1 Parent(s): db07284

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -18
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import pandas_profiling as pp
2
- from huggingface_hub.hf_api import create_repo
3
  from huggingface_hub.repository import Repository
4
  import gradio as gr
5
  import pandas as pd
@@ -20,25 +20,12 @@ def profile_dataset(dataset, username, token, dataset_name):
20
 
21
  repo_url = create_repo(f"{username}/{dataset_name}", repo_type = "space", token = token, space_sdk = "static")
22
 
23
- subprocess.run(
24
- f"git clone {repo_url}".split(),
25
- encoding="utf-8",
26
- cwd= os.getcwd(),
27
- check=True,
28
- env=os.environ.copy(),
29
- )
30
-
31
- repo = Repository(
32
- clone_from = repo_url,
33
- local_dir=f"{username}/{dataset_name}",
34
- git_user = "merve",
35
- git_email = "[email protected]",
36
- )
37
 
38
  profile.to_file(f"{username}/{dataset_name}/index.html")
39
- repo.git_add()
40
- repo.git_commit(commit_message = "Dataset report")
41
- repo.git_push()
 
42
  return f"Your dataset report will be ready at {repo_url}"
43
 
44
  gr.Interface(profile_dataset, inputs = [dataset, username, token, dataset_name], outputs=[output_text], enable_queue = True).launch(debug=True)
 
1
  import pandas_profiling as pp
2
+ from huggingface_hub.hf_api import create_repo, upload_file
3
  from huggingface_hub.repository import Repository
4
  import gradio as gr
5
  import pandas as pd
 
20
 
21
  repo_url = create_repo(f"{username}/{dataset_name}", repo_type = "space", token = token, space_sdk = "static")
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  profile.to_file(f"{username}/{dataset_name}/index.html")
25
+ upload_file(path_or_fileobj =f"{username}/{dataset_name}/index.html", repo_id =f"{username}/{dataset_name}", repo_type = "space", token=token)
26
+
27
+
28
+
29
  return f"Your dataset report will be ready at {repo_url}"
30
 
31
  gr.Interface(profile_dataset, inputs = [dataset, username, token, dataset_name], outputs=[output_text], enable_queue = True).launch(debug=True)