diff --git a/server/main.py b/server/main.py index 756d5de..ade045f 100644 --- a/server/main.py +++ b/server/main.py @@ -2,7 +2,7 @@ from PIL import Image from sanic import Sanic -from sanic.response import json as json_answer +from sanic.response import json as json_answer, text import numpy as np from tensorflow import keras from tensorflow.keras.utils import img_to_array @@ -49,7 +49,10 @@ def get_images(): IMAGES[item.get("text")] = s.get("url") break + get_images() + + @app.post("/beeds") async def beeds(request): body = request.files.get("f").body @@ -97,5 +100,38 @@ async def beeds(request): }) +sitemap_data = ''' + + + + + + https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/ + 2023-05-01T19:01:03+00:00 + + + + +''' + +@app.get("/sitemap.xml") +async def sitemaps(request): + return text(sitemap_data, content_type="application/xml") + +robots_data = ''' +User-agent: * +Allow: / + +Sitemap: https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/sitemap.xml +''' + +@app.get("/robots.txt") +async def robots(request): + return text(robots_data) + if __name__ == "__main__": app.run(auto_reload=True, port=4003, host="0.0.0.0") diff --git a/server/static/scripts.js b/server/static/scripts.js index dfb2989..5ec2d63 100644 --- a/server/static/scripts.js +++ b/server/static/scripts.js @@ -5,7 +5,7 @@ async function SavePhoto() { document.getElementById("result").innerHTML = ""; let photo = document.getElementById("file-input").files[0]; let formData = new FormData(); - + // TODO: пройтись по всем результатм - если совпадают дважды - поднять вверх formData.append("f", photo); let response = await fetch('/beeds', { method: "POST", body: formData }); if (response.ok) {