CognitiveScience commited on
Commit
4024d85
1 Parent(s): 45676cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -117,10 +117,10 @@ with gr.Blocks(css=css) as demo:
117
  load_data()
118
  #return "Hello " + name + "!"
119
  def backup_db():
120
- shutil.copyfile(DB_FILE, "./reviews.2db")
121
  db = sqlite3.connect(DB_FILE)
122
  reviews = db.execute("SELECT * FROM reviews").fetchall()
123
- pd.DataFrame(reviews).to_csv("./reviews1.csv", index=False)
124
  print("updating db")
125
  repo.push_to_hub(blocking=False, commit_message=f"Updating data at {datetime.datetime.now()}")
126
 
@@ -135,7 +135,8 @@ scheduler2 = BackgroundScheduler()
135
  scheduler2.add_job(func=run_actr, trigger="interval", seconds=600)
136
  scheduler2.start()
137
 
138
- #scheduler2 = BackgroundScheduler()
139
- #scheduler2.add_job(func=load_data2, trigger="interval", seconds=60)
140
- #scheduler2.start()
 
141
  demo.launch()
 
117
  load_data()
118
  #return "Hello " + name + "!"
119
  def backup_db():
120
+ shutil.copyfile(DB_FILE, "./reviews.db")
121
  db = sqlite3.connect(DB_FILE)
122
  reviews = db.execute("SELECT * FROM reviews").fetchall()
123
+ pd.DataFrame(reviews).to_csv("./reviews.csv", index=False)
124
  print("updating db")
125
  repo.push_to_hub(blocking=False, commit_message=f"Updating data at {datetime.datetime.now()}")
126
 
 
135
  scheduler2.add_job(func=run_actr, trigger="interval", seconds=600)
136
  scheduler2.start()
137
 
138
+ scheduler2 = BackgroundScheduler()
139
+ scheduler2.add_job(func=backup_db, trigger="interval", seconds=900)
140
+ scheduler2.start()
141
+
142
  demo.launch()