Spaces:
Running
Running
File size: 732 Bytes
8e0fcfe e42fcaf 8e0fcfe e42fcaf 8e0fcfe e42fcaf 8e0fcfe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import firebase_admin
from firebase_admin import credentials, firestore
from datetime import datetime
# Load credentials (ensure this JSON is uploaded as a private file on Hugging Face or locally)
cred = credentials.Certificate("firebase_key.json") # Keep this secure
firebase_admin.initialize_app(cred)
db = firestore.client()
def log_interaction(goal, sol1, sol2, evo, gpt, correct=None, source="user"):
doc = {
"timestamp": datetime.utcnow().isoformat(),
"goal": goal,
"solution_1": sol1,
"solution_2": sol2,
"evo_answer": evo,
"gpt_answer": gpt,
"correct_answer": correct if correct else gpt,
"source": source
}
db.collection("evo_logs").add(doc)
|