Spaces:
Runtime error
Runtime error
CognitiveScience
commited on
Commit
•
b934676
1
Parent(s):
bb23640
Update app.py
Browse files
app.py
CHANGED
@@ -52,14 +52,14 @@ except sqlite3.OperationalError:
|
|
52 |
def get_latest_reviews(db: sqlite3.Connection):
|
53 |
reviews = db.execute("SELECT * FROM reviews ORDER BY id DESC limit 100").fetchall()
|
54 |
total_reviews = db.execute("Select COUNT(id) from reviews").fetchone()[0]
|
55 |
-
reviews = pd.DataFrame(reviews, columns=["id", "date_created", "name", "rate", "
|
56 |
return reviews, total_reviews
|
57 |
|
58 |
|
59 |
def ccogsphere(name: str, rate: int, celsci: str):
|
60 |
db = sqlite3.connect(DB_FILE)
|
61 |
cursor = db.cursor()
|
62 |
-
cursor.execute("INSERT INTO reviews(name, rate,
|
63 |
db.commit()
|
64 |
reviews, total_reviews = get_latest_reviews(db)
|
65 |
db.close()
|
|
|
52 |
def get_latest_reviews(db: sqlite3.Connection):
|
53 |
reviews = db.execute("SELECT * FROM reviews ORDER BY id DESC limit 100").fetchall()
|
54 |
total_reviews = db.execute("Select COUNT(id) from reviews").fetchone()[0]
|
55 |
+
reviews = pd.DataFrame(reviews, columns=["id", "date_created", "name", "rate", "celsci"])
|
56 |
return reviews, total_reviews
|
57 |
|
58 |
|
59 |
def ccogsphere(name: str, rate: int, celsci: str):
|
60 |
db = sqlite3.connect(DB_FILE)
|
61 |
cursor = db.cursor()
|
62 |
+
cursor.execute("INSERT INTO reviews(name, rate, celsci) VALUES(?,?,?)", [name, rate, celsci])
|
63 |
db.commit()
|
64 |
reviews, total_reviews = get_latest_reviews(db)
|
65 |
db.close()
|