mrfakename commited on
Commit
1ec31d9
1 Parent(s): cd5bd26

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -19
app.py CHANGED
@@ -31,6 +31,25 @@ try:
31
  except Exception as e:
32
  print("Error while downloading DB:", e)
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  # Create DB table (if doesn't exist)
35
  create_db_if_missing()
36
 
@@ -175,25 +194,6 @@ model_licenses = {
175
  def get_db():
176
  return sqlite3.connect(DB_PATH)
177
 
178
- def create_db_if_missing():
179
- conn = get_db()
180
- cursor = conn.cursor()
181
- cursor.execute('''
182
- CREATE TABLE IF NOT EXISTS model (
183
- name TEXT UNIQUE,
184
- upvote INTEGER,
185
- downvote INTEGER
186
- );
187
- ''')
188
- cursor.execute('''
189
- CREATE TABLE IF NOT EXISTS vote (
190
- id INTEGER PRIMARY KEY AUTOINCREMENT,
191
- username TEXT,
192
- model TEXT,
193
- vote INTEGER
194
- );
195
- ''')
196
-
197
  def get_leaderboard():
198
  conn = get_db()
199
  cursor = conn.cursor()
 
31
  except Exception as e:
32
  print("Error while downloading DB:", e)
33
 
34
+ def create_db_if_missing():
35
+ conn = get_db()
36
+ cursor = conn.cursor()
37
+ cursor.execute('''
38
+ CREATE TABLE IF NOT EXISTS model (
39
+ name TEXT UNIQUE,
40
+ upvote INTEGER,
41
+ downvote INTEGER
42
+ );
43
+ ''')
44
+ cursor.execute('''
45
+ CREATE TABLE IF NOT EXISTS vote (
46
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
47
+ username TEXT,
48
+ model TEXT,
49
+ vote INTEGER
50
+ );
51
+ ''')
52
+
53
  # Create DB table (if doesn't exist)
54
  create_db_if_missing()
55
 
 
194
  def get_db():
195
  return sqlite3.connect(DB_PATH)
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  def get_leaderboard():
198
  conn = get_db()
199
  cursor = conn.cursor()