updates
This commit is contained in:
parent
21b82eb274
commit
e5aa8e5d24
File diff suppressed because one or more lines are too long
15
app.py
15
app.py
@ -1,6 +1,13 @@
|
|||||||
from flask import Flask, send_file, render_template, request
|
from flask import Flask, send_file, render_template, request
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from models.multiresolution_flow_3d import *
|
||||||
|
from models.trainer import *
|
||||||
|
|
||||||
|
tm_borg = []
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
@ -24,4 +31,12 @@ def generate_file():
|
|||||||
return output_path
|
return output_path
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
|
||||||
|
nlevel=8
|
||||||
|
shape = (2**nlevel,2**nlevel,2**nlevel)
|
||||||
|
model = multi_scale_model(nlevel=nlevel)
|
||||||
|
tm_borg = trainer(model)
|
||||||
|
tm_borg.transfer(silent=False)
|
||||||
|
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
@ -1,27 +1,13 @@
|
|||||||
from flask import Flask, send_file, render_template, request
|
<!doctype html>
|
||||||
import os
|
<html lang="en">
|
||||||
|
<head>
|
||||||
app = Flask(__name__)
|
<meta charset="utf-8">
|
||||||
|
<title>File Generator</title>
|
||||||
@app.route('/')
|
</head>
|
||||||
def home():
|
<body>
|
||||||
return render_template('index.html')
|
<h1>Generate and Download File</h1>
|
||||||
|
<form action="/generate" method="post">
|
||||||
@app.route('/generate', methods=['POST'])
|
<button type="submit">Generate File</button>
|
||||||
def generate():
|
</form>
|
||||||
# Call your Python script or function here
|
</body>
|
||||||
output_file = generate_file()
|
</html>
|
||||||
|
|
||||||
# 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__':
|
|
||||||
app.run(debug=True)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user