Spaces:
Running
Running
from flask import Flask, render_template, request, jsonify | |
import json | |
app = Flask(__name__) | |
# Store nodes and connections in memory (replace with database for persistence) | |
nodes = [] | |
connections = [] | |
def index(): | |
return render_template('index.html') | |
def save_nodes(): | |
global nodes, connections | |
data = request.get_json() | |
nodes = data.get('nodes', []) | |
connections = data.get('connections', []) | |
return jsonify({'status': 'success', 'nodes': nodes, 'connections': connections}) | |
if __name__ == '__main__': | |
app.run(host="0.0.0.0", port=7860, debug=True) |