oceddyyy commited on
Commit
bd9d487
Β·
verified Β·
1 Parent(s): c9ae4c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -82,13 +82,14 @@ def save_json_to_dataset(json_str):
82
  return "❌ HF_TOKEN not found in environment."
83
 
84
  repo_id = "UniversityAIChatbot/University_Inquiries_AI_Chatbot"
85
- target_file = "database.json"
86
  local_dir = "hf_repo"
87
 
88
  repo = Repository(
89
  local_dir=local_dir,
90
  clone_from=repo_id,
91
  use_auth_token=hf_token,
 
92
  )
93
 
94
  repo.git_pull()
@@ -113,7 +114,7 @@ def save_json_to_dataset(json_str):
113
  with open(full_path, "w", encoding="utf-8") as f:
114
  json.dump(updated_data, f, indent=2, ensure_ascii=False)
115
 
116
- repo.push_to_hub(commit_message="πŸ“₯ Add new Q&A to database.json")
117
 
118
  return "βœ… Data with timestamp successfully pushed to Space!"
119
  except Exception as e:
 
82
  return "❌ HF_TOKEN not found in environment."
83
 
84
  repo_id = "UniversityAIChatbot/University_Inquiries_AI_Chatbot"
85
+ target_file = "dataset.json" # Or change to database.json if needed
86
  local_dir = "hf_repo"
87
 
88
  repo = Repository(
89
  local_dir=local_dir,
90
  clone_from=repo_id,
91
  use_auth_token=hf_token,
92
+ repo_type="space" # βœ… THIS IS THE KEY FIX
93
  )
94
 
95
  repo.git_pull()
 
114
  with open(full_path, "w", encoding="utf-8") as f:
115
  json.dump(updated_data, f, indent=2, ensure_ascii=False)
116
 
117
+ repo.push_to_hub(commit_message="πŸ“₯ Add new Q&A to dataset.json")
118
 
119
  return "βœ… Data with timestamp successfully pushed to Space!"
120
  except Exception as e: