-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_demo.py
More file actions
42 lines (35 loc) · 1.6 KB
/
Copy pathrun_demo.py
File metadata and controls
42 lines (35 loc) · 1.6 KB
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
38
39
40
41
42
import os
import sys
from src.benchmark_db import setup_benchmark_databases, PAGILA_DB_PATH
from src.dataset_generator import build_dataset, DATASET_PATH
from src.train import train_model, MODEL_PATH
from app import app, load_ai_assets
def main():
print("=========================================================================")
print(" DeepQuery: AI-Based SQL Query Recommendation and Performance Ranking ")
print("=========================================================================\n")
# Step 1: Initialize Benchmark Databases
if not os.path.exists(PAGILA_DB_PATH):
print("[Step 1/3] Building Pagila & TPC-H Benchmark Databases...")
setup_benchmark_databases()
else:
print("[Step 1/3] Pagila & TPC-H Benchmark Databases found.")
# Step 2: Build Dataset
if not os.path.exists(DATASET_PATH):
print("[Step 2/3] Profiling Queries & Building Dataset...")
build_dataset()
else:
print("[Step 2/3] Benchmark Dataset found.")
# Step 3: Train ANN Model
if not os.path.exists(MODEL_PATH):
print("[Step 3/3] Training 4-Layer Artificial Neural Network (ANN)...")
train_model()
else:
print("[Step 3/3] Trained Deep Learning Model found.")
print("\n-------------------------------------------------------------------------")
print(" DeepQuery AI System Ready! Launching Web Dashboard on http://127.0.0.1:5000")
print("-------------------------------------------------------------------------\n")
load_ai_assets()
app.run(host='127.0.0.1', port=5000, debug=False)
if __name__ == '__main__':
main()