SailajaS commited on
Commit
09d30ea
·
verified ·
1 Parent(s): 1624ddc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -10,8 +10,9 @@ import os
10
  # Make sure the Hugging Face token is set in the environment or manually provide it
11
  # This ensures authentication works before interacting with the Hugging Face API
12
  hf_token = os.getenv("HF_HOME", "your_hugging_face_token") # You can also manually insert the token here
 
 
13
  api = HfApi()
14
- api.set_access_token(hf_token)
15
 
16
  # Step 2: Create a sample dataset
17
  data = {
@@ -35,7 +36,8 @@ dataset = Dataset.from_pandas(df)
35
  # Step 3: Upload the dataset to Hugging Face
36
  repo_id = "SailajaS/case-feedback-dataset" # Replace with your actual Hugging Face repo name
37
  try:
38
- api.create_repo(repo_id=repo_id, repo_type="dataset")
 
39
  print(f"Successfully created repository: {repo_id}")
40
  except Exception as e:
41
  print(f"Error creating repository: {e}")
 
10
  # Make sure the Hugging Face token is set in the environment or manually provide it
11
  # This ensures authentication works before interacting with the Hugging Face API
12
  hf_token = os.getenv("HF_HOME", "your_hugging_face_token") # You can also manually insert the token here
13
+
14
+ # Create a Hugging Face API client instance
15
  api = HfApi()
 
16
 
17
  # Step 2: Create a sample dataset
18
  data = {
 
36
  # Step 3: Upload the dataset to Hugging Face
37
  repo_id = "SailajaS/case-feedback-dataset" # Replace with your actual Hugging Face repo name
38
  try:
39
+ # You now pass the token directly in the `create_repo` method
40
+ api.create_repo(repo_id=repo_id, repo_type="dataset", token=hf_token)
41
  print(f"Successfully created repository: {repo_id}")
42
  except Exception as e:
43
  print(f"Error creating repository: {e}")