Add minimal Flask service
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
import platform
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from flask import Flask, jsonify, render_template
|
||||
import flask
|
||||
|
||||
|
||||
VERSION = "0.0.1"
|
||||
app = Flask(__name__, template_folder="templates", static_folder="static")
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return render_template(
|
||||
"index.html",
|
||||
version=VERSION,
|
||||
current_time=datetime.now(timezone.utc).isoformat(),
|
||||
python_version=platform.python_version(),
|
||||
flask_version=flask.__version__,
|
||||
)
|
||||
|
||||
|
||||
@app.route("/health")
|
||||
def health():
|
||||
return jsonify(status="ok", version=VERSION)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True, host="0.0.0.0", port=5000)
|
||||
@@ -0,0 +1,42 @@
|
||||
:root {
|
||||
color-scheme: light;
|
||||
font-family: system-ui, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: #eef4f2;
|
||||
color: #18322f;
|
||||
}
|
||||
|
||||
main {
|
||||
width: min(92vw, 36rem);
|
||||
padding: 2.5rem;
|
||||
background: white;
|
||||
border: 1px solid #c7d9d4;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 1rem 3rem rgb(24 50 47 / 12%);
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
dl {
|
||||
display: grid;
|
||||
grid-template-columns: max-content 1fr;
|
||||
gap: 0.75rem 1.5rem;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
dt {
|
||||
color: #52736d;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
font-family: ui-monospace, monospace;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Recipe handwriting recognition</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>Recipe handwriting recognition</h1>
|
||||
<p>Managed Flask server is running.</p>
|
||||
<dl>
|
||||
<dt>Version</dt><dd>{{ version }}</dd>
|
||||
<dt>UTC time</dt><dd>{{ current_time }}</dd>
|
||||
<dt>Python</dt><dd>{{ python_version }}</dd>
|
||||
<dt>Flask</dt><dd>{{ flask_version }}</dd>
|
||||
</dl>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user