Update app.py
Browse files
app.py
CHANGED
@@ -126,7 +126,6 @@ def load_qa_history():
|
|
126 |
def save_qa_history(history_entry):
|
127 |
"""Save QA history entry to local JSON file and push to Hugging Face"""
|
128 |
try:
|
129 |
-
|
130 |
history_file = Path("qa_history.json")
|
131 |
|
132 |
# Initialize or load existing history
|
@@ -146,6 +145,9 @@ def save_qa_history(history_entry):
|
|
146 |
with open("qa_history.json", "w", encoding="utf-8") as f:
|
147 |
json.dump(history_data, f, ensure_ascii=False, indent=2)
|
148 |
|
|
|
|
|
|
|
149 |
# Push to Hugging Face
|
150 |
hf_token = os.getenv('HF_TOKEN') or st.secrets['HF_TOKEN']
|
151 |
api = HfApi(token=hf_token)
|
|
|
126 |
def save_qa_history(history_entry):
|
127 |
"""Save QA history entry to local JSON file and push to Hugging Face"""
|
128 |
try:
|
|
|
129 |
history_file = Path("qa_history.json")
|
130 |
|
131 |
# Initialize or load existing history
|
|
|
145 |
with open("qa_history.json", "w", encoding="utf-8") as f:
|
146 |
json.dump(history_data, f, ensure_ascii=False, indent=2)
|
147 |
|
148 |
+
# Introduce a delay before pushing to Hugging Face
|
149 |
+
time.sleep(30) # Sleep for 30 seconds
|
150 |
+
|
151 |
# Push to Hugging Face
|
152 |
hf_token = os.getenv('HF_TOKEN') or st.secrets['HF_TOKEN']
|
153 |
api = HfApi(token=hf_token)
|