Spaces:
Runtime error
Runtime error
CognitiveScience
commited on
Commit
•
b9fa3aa
1
Parent(s):
1c010e6
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ from apscheduler.schedulers.background import BackgroundScheduler
|
|
16 |
import random
|
17 |
import time
|
18 |
|
19 |
-
DB_FILE = "./
|
20 |
|
21 |
TOKEN = os.environ.get('HF_KEY')
|
22 |
|
@@ -29,7 +29,7 @@ repo = huggingface_hub.Repository(
|
|
29 |
repo.git_pull()
|
30 |
|
31 |
# Set db to latest
|
32 |
-
#shutil.copyfile("./data/
|
33 |
|
34 |
# Create table if it doesn't already exist
|
35 |
|
@@ -98,7 +98,7 @@ with gr.Blocks(css=css,api_name=["/ccogsphere"]) as demo:
|
|
98 |
#return "Hello " + name + "!"
|
99 |
|
100 |
def backup_db():
|
101 |
-
shutil.copyfile(DB_FILE, "./
|
102 |
db = sqlite3.connect(DB_FILE)
|
103 |
reviews = db.execute("SELECT * FROM reviews").fetchall()
|
104 |
pd.DataFrame(reviews).to_csv("./reviews1.csv", index=False)
|
@@ -112,7 +112,7 @@ def load_data2():
|
|
112 |
return reviews, total_reviews
|
113 |
|
114 |
scheduler = BackgroundScheduler()
|
115 |
-
scheduler.add_job(func=backup_db, trigger="interval", seconds=
|
116 |
scheduler.start()
|
117 |
|
118 |
#scheduler2 = BackgroundScheduler()
|
|
|
16 |
import random
|
17 |
import time
|
18 |
|
19 |
+
DB_FILE = "./reviews1.db"
|
20 |
|
21 |
TOKEN = os.environ.get('HF_KEY')
|
22 |
|
|
|
29 |
repo.git_pull()
|
30 |
|
31 |
# Set db to latest
|
32 |
+
#shutil.copyfile("./data/reviews0.db", DB_FILE)
|
33 |
|
34 |
# Create table if it doesn't already exist
|
35 |
|
|
|
98 |
#return "Hello " + name + "!"
|
99 |
|
100 |
def backup_db():
|
101 |
+
shutil.copyfile(DB_FILE, "./reviews.2db")
|
102 |
db = sqlite3.connect(DB_FILE)
|
103 |
reviews = db.execute("SELECT * FROM reviews").fetchall()
|
104 |
pd.DataFrame(reviews).to_csv("./reviews1.csv", index=False)
|
|
|
112 |
return reviews, total_reviews
|
113 |
|
114 |
scheduler = BackgroundScheduler()
|
115 |
+
scheduler.add_job(func=backup_db, trigger="interval", seconds=240)
|
116 |
scheduler.start()
|
117 |
|
118 |
#scheduler2 = BackgroundScheduler()
|