Spaces:
Build error
Build error
Commit
·
bcd4915
1
Parent(s):
4fe16d2
update
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import json
|
|
| 3 |
import random
|
| 4 |
import os
|
| 5 |
import string
|
|
|
|
| 6 |
import logging
|
| 7 |
|
| 8 |
# Set up logging
|
|
@@ -16,6 +17,8 @@ logger = logging.getLogger(__name__)
|
|
| 16 |
|
| 17 |
app = Flask(__name__)
|
| 18 |
app.config['SECRET_KEY'] = 'supersecretkey' # Change this to a random secret key
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Directories for visualizations
|
| 21 |
VISUALIZATION_DIRS_PLAN_OF_SQLS = {
|
|
@@ -105,8 +108,6 @@ def index():
|
|
| 105 |
logger.exception(f"Error in index route: {e}")
|
| 106 |
return "An error occurred", 500
|
| 107 |
return render_template('index.html')
|
| 108 |
-
|
| 109 |
-
|
| 110 |
@app.route('/experiment/<username>/<sample_index>/<seed>/<filename>', methods=['GET'])
|
| 111 |
def experiment(username, sample_index, seed, filename):
|
| 112 |
try:
|
|
@@ -277,5 +278,24 @@ def completed(filename):
|
|
| 277 |
return "An error occurred", 500
|
| 278 |
|
| 279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
if __name__ == "__main__":
|
| 281 |
app.run(host="0.0.0.0", port=7860)
|
|
|
|
|
|
| 3 |
import random
|
| 4 |
import os
|
| 5 |
import string
|
| 6 |
+
from flask_session import Session
|
| 7 |
import logging
|
| 8 |
|
| 9 |
# Set up logging
|
|
|
|
| 17 |
|
| 18 |
app = Flask(__name__)
|
| 19 |
app.config['SECRET_KEY'] = 'supersecretkey' # Change this to a random secret key
|
| 20 |
+
app.config['SESSION_TYPE'] = 'redis'
|
| 21 |
+
Session(app)
|
| 22 |
|
| 23 |
# Directories for visualizations
|
| 24 |
VISUALIZATION_DIRS_PLAN_OF_SQLS = {
|
|
|
|
| 108 |
logger.exception(f"Error in index route: {e}")
|
| 109 |
return "An error occurred", 500
|
| 110 |
return render_template('index.html')
|
|
|
|
|
|
|
| 111 |
@app.route('/experiment/<username>/<sample_index>/<seed>/<filename>', methods=['GET'])
|
| 112 |
def experiment(username, sample_index, seed, filename):
|
| 113 |
try:
|
|
|
|
| 278 |
return "An error occurred", 500
|
| 279 |
|
| 280 |
|
| 281 |
+
# if __name__ == '__main__':
|
| 282 |
+
# try:
|
| 283 |
+
# app.run(debug=False, port=7860)
|
| 284 |
+
# except Exception as e:
|
| 285 |
+
# logger.exception(f"Failed to start app: {e}")
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
# from flask import Flask
|
| 289 |
+
#
|
| 290 |
+
# app = Flask(__name__)
|
| 291 |
+
#
|
| 292 |
+
# @app.route('/')
|
| 293 |
+
# def index():
|
| 294 |
+
# return "Hello, world!"
|
| 295 |
+
|
| 296 |
+
# if __name__ == '__main__':
|
| 297 |
+
# app.run(debug=False, port=7860)
|
| 298 |
+
|
| 299 |
if __name__ == "__main__":
|
| 300 |
app.run(host="0.0.0.0", port=7860)
|
| 301 |
+
|