mrfakename commited on
Commit
9658d8a
1 Parent(s): 437deb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -22,6 +22,7 @@ A list of the models, based on how highly they are ranked!
22
  import gradio as gr
23
  import random
24
  import os
 
25
  import pandas as pd
26
  import sqlite3
27
  from datasets import load_dataset
@@ -204,7 +205,7 @@ def sync_db():
204
  token=os.getenv('HF_TOKEN')
205
  )
206
  while True:
207
- time.sleep(45)
208
  print("Uploading DB")
209
  api.upload_file(
210
  path_or_fileobj='database.db',
@@ -223,12 +224,13 @@ if os.getenv('DATASET_ID'):
223
  )
224
  print("Downloading DB...")
225
  try:
226
- api.hf_hub_download(
227
  repo_id=os.getenv('DATASET_ID'),
228
  repo_type='dataset',
229
  filename='database.db',
230
  cache_dir='./'
231
  )
 
232
  print("Downloaded DB")
233
  except:
234
  pass
 
22
  import gradio as gr
23
  import random
24
  import os
25
+ import shutil
26
  import pandas as pd
27
  import sqlite3
28
  from datasets import load_dataset
 
205
  token=os.getenv('HF_TOKEN')
206
  )
207
  while True:
208
+ time.sleep(60 * 15)
209
  print("Uploading DB")
210
  api.upload_file(
211
  path_or_fileobj='database.db',
 
224
  )
225
  print("Downloading DB...")
226
  try:
227
+ path = api.hf_hub_download(
228
  repo_id=os.getenv('DATASET_ID'),
229
  repo_type='dataset',
230
  filename='database.db',
231
  cache_dir='./'
232
  )
233
+ shutil.copyfile(path, 'database.db')
234
  print("Downloaded DB")
235
  except:
236
  pass