Spaces:
Running
Running
| # init_db.py | |
| import sqlite3 | |
| import os | |
| os.makedirs("me", exist_ok=True) | |
| db_path = os.path.join("me", "qa.db") | |
| conn = sqlite3.connect(db_path) | |
| cur = conn.cursor() | |
| cur.execute(""" | |
| CREATE TABLE IF NOT EXISTS faq ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| question TEXT, | |
| answer TEXT | |
| ) | |
| """) | |
| # sample seed data (you can edit) | |
| faq_data = [ | |
| ("What is Akash's tech stack?", "Akash works with the MERN stack: MongoDB, Express, React, Node.js."), | |
| ("What projects has Akash completed?", "Online Marketplace for Local Artisans, Freelance Collaboration Platform, Hotel Reservation System."), | |
| ("What is Akash studying?", "MCA at KLN College."), | |
| ] | |
| # clear existing sample rows (optional) | |
| cur.execute("DELETE FROM faq") | |
| cur.executemany("INSERT INTO faq (question, answer) VALUES (?, ?)", faq_data) | |
| conn.commit() | |
| conn.close() | |
| print("me/qa.db created and seeded.") | |