Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
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:
|