ICOD/app.py

43 lines
1011 B
Python
Raw Normal View History

2024-06-10 15:24:03 +02:00
from flask import Flask, send_file, render_template, request
import os
2024-06-10 17:51:51 +02:00
import numpy as np
from models.multiresolution_flow_3d import *
from models.trainer import *
tm_borg = []
2024-06-10 15:24:03 +02:00
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/generate', methods=['POST'])
def generate():
# Call your Python script or function here
output_file = generate_file()
# Provide the file for download
return send_file(output_file, as_attachment=True)
def generate_file():
# This is where you generate your file
# For demonstration, we will create a simple text file
output_path = 'output.txt'
with open(output_path, 'w') as f:
f.write('Hello, this is the generated file.')
return output_path
if __name__ == '__main__':
2024-06-10 17:51:51 +02:00
nlevel=8
shape = (2**nlevel,2**nlevel,2**nlevel)
model = multi_scale_model(nlevel=nlevel)
tm_borg = trainer(model)
tm_borg.transfer(silent=False)
2024-06-10 15:24:03 +02:00
app.run(debug=True)