roundabout,
created on Saturday, 7 September 2024, 13:08:51 (1725714531),
received on Saturday, 7 September 2024, 16:16:28 (1725725788)
Author identity: vlad <vlad.muntoiu@gmail.com>
6a24ac46628da786cca0ef63d244ff0d43d1c0b4
app.py
@@ -248,7 +248,7 @@ with app.app_context():
@app.route("/") def index(): return flask.render_template("home.html")return flask.render_template("home.html", resources=PictureResource.query.order_by(db.func.random()).limit(10).all())@app.route("/accounts/")
templates/home.html
@@ -6,5 +6,44 @@
<p> Free image data for machine learning, computer vision, data science, research, and more. </p> <h2>Random pictures</h2> <ul class="thumbnail-list"> {% for resource in resources %} <li> <a href="/picture/{{ resource.id }}"> <div class="annotation-zone"> <img src="/raw/picture/{{ resource.id }}" alt="{{ resource.title }}"> {% for region in resource.regions %} {% if region.json.type == "bbox" %} <svg class="shape-container" viewBox="0 0 {{ resource.width }} {{ resource.height }}"> <rect x="{{ region.json.shape.x * resource.width }}" y="{{ region.json.shape.y * resource.height }}" width="{{ region.json.shape.w * resource.width }}" height="{{ region.json.shape.h * resource.height }}" fill="none" class="shape-bbox shape" ></rect> </svg> {% elif region.json.type == "polygon" %} <svg class="shape-container" viewBox="0 0 {{ resource.width }} {{ resource.height }}"> <polygon points="{% for point in region.json.shape %}{{ point.x * resource.width }},{{ point.y * resource.height }} {% endfor %}" fill="none" class="shape-polygon shape"></polygon> </svg> {% elif region.json.type == "polyline" %} <svg class="shape-container" viewBox="0 0 {{ resource.width }} {{ resource.height }}"> <polyline points="{% for point in region.json.shape %}{{ point.x * resource.width }},{{ point.y * resource.height }} {% endfor %}" fill="none" class="shape-polyline shape"></polyline> </svg> {% elif region.json.type == "point" %} <svg class="shape-container" viewBox="0 0 {{ resource.width }} {{ resource.height }}"> <circle cx="{{ region.json.shape.x * resource.width }}" cy="{{ region.json.shape.y * resource.height }}" r="0" fill="none" class="shape-point shape"></circle> </svg> {% endif %} {% endfor %} </div> <div class="list-detail"> {{ resource.title }} </div> </a> </li> {% endfor %} </ul></x-frame> {% endblock %}