-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_demo_db.py
37 lines (27 loc) · 923 Bytes
/
create_demo_db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from app import db
db.drop_all()
import os, shutil
folder = './app/static/tmp'
for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
try:
if os.path.isfile(file_path):
os.remove(file_path)
elif os.path.isdir(file_path): shutil.rmtree(file_path)
except Exception as e:
print(e)
db.create_all()
from app.models import Generator
from app.models import EvolutionaryStrategy
from app.models import Category
generator = Generator(name='demo')
#DB change -> NeuralNetwork = Generator
evolution_strategy = EvolutionaryStrategy(name='spherical',population_size=20, latent_size=20)
#DB change -> EvolAI = EvolutionaryStrategy
db.session.add(generator)
db.session.add(evolution_strategy)
db.session.commit()
category = Category(name='Demo', Gene=1, ES=1, visible=True)
# #DB change -> Generator = Category
db.session.add(category)
db.session.commit()