Spaces:
Runtime error
Runtime error
Commit
·
b186ceb
1
Parent(s):
7bccb36
Update app.py
Browse files
app.py
CHANGED
@@ -64,7 +64,7 @@ except sqlite3.OperationalError:
|
|
64 |
'''
|
65 |
CREATE TABLE reviews (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
66 |
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
67 |
-
name TEXT,
|
68 |
''')
|
69 |
db.commit()
|
70 |
db.close()
|
@@ -74,7 +74,7 @@ except sqlite3.OperationalError:
|
|
74 |
def get_latest_reviews(db: sqlite3.Connection):
|
75 |
reviews = db.execute("SELECT * FROM reviews ORDER BY id DESC limit 100").fetchall()
|
76 |
total_reviews = db.execute("Select COUNT(id) from reviews").fetchone()[0]
|
77 |
-
reviews = pd.DataFrame(reviews, columns=["id", "date_created", "name", "
|
78 |
return reviews, total_reviews
|
79 |
|
80 |
def get_latest_reviews2(db: sqlite3.Connection):
|
@@ -99,7 +99,7 @@ def ccogsphere(name: str, rate: int, celsci: str):
|
|
99 |
duration = str(row["duration"])
|
100 |
print(view, duration)
|
101 |
#celsci=celsci+celsci2
|
102 |
-
cursor.execute("INSERT INTO reviews(name,
|
103 |
db.commit()
|
104 |
|
105 |
reviews, total_reviews = get_latest_reviews(db)
|
|
|
64 |
'''
|
65 |
CREATE TABLE reviews (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
66 |
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
67 |
+
name TEXT, view TEXT, duration TEXT)
|
68 |
''')
|
69 |
db.commit()
|
70 |
db.close()
|
|
|
74 |
def get_latest_reviews(db: sqlite3.Connection):
|
75 |
reviews = db.execute("SELECT * FROM reviews ORDER BY id DESC limit 100").fetchall()
|
76 |
total_reviews = db.execute("Select COUNT(id) from reviews").fetchone()[0]
|
77 |
+
reviews = pd.DataFrame(reviews, columns=["id", "date_created", "name", "view", "duration"])
|
78 |
return reviews, total_reviews
|
79 |
|
80 |
def get_latest_reviews2(db: sqlite3.Connection):
|
|
|
99 |
duration = str(row["duration"])
|
100 |
print(view, duration)
|
101 |
#celsci=celsci+celsci2
|
102 |
+
cursor.execute("INSERT INTO reviews(name, view, duration) VALUES(?,?,?)", [celsci+str(index+1), view, duration])
|
103 |
db.commit()
|
104 |
|
105 |
reviews, total_reviews = get_latest_reviews(db)
|