mirror of https://github.com/ivanch/tcc.git
alguns consertos
This commit is contained in:
parent
35aaf31ba7
commit
4ea131299a
|
@ -1,8 +0,0 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="Flask">
|
||||
<option name="enabled" value="true" />
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/../FlaskAPI\templates" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</module>
|
|
@ -1,6 +0,0 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (FlaskAPI)" project-jdk-type="Python SDK" />
|
||||
</project>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/FlaskAPI.iml" filepath="$PROJECT_DIR$/.idea/FlaskAPI.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"version": "0.0.1",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Python: Flask",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"module": "flask",
|
||||
"env": { "FLASK_APP": "app.py", "FLASK_DEBUG": "1" },
|
||||
"args": ["run", "--no-debugger", "--no-reload"],
|
||||
"jinja": true,
|
||||
"justMyCode": true
|
||||
}
|
||||
|
||||
]
|
||||
}
|
|
@ -1,22 +1,11 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Comments are provided throughout this file to help you get started.
|
||||
# If you need more help, visit the Dockerfile reference guide at
|
||||
# https://docs.docker.com/engine/reference/builder/
|
||||
|
||||
ARG PYTHON_VERSION=3.10.12
|
||||
FROM python:${PYTHON_VERSION}-slim as base
|
||||
|
||||
# Prevents Python from writing pyc files.
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
# Keeps Python from buffering stdout and stderr to avoid situations where
|
||||
# the application crashes without emitting any logs due to buffering.
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the source code into the container.
|
||||
COPY . .
|
||||
|
||||
RUN apt-get update && apt-get install -y imagemagick && apt-get install -y wget && ls
|
||||
|
@ -30,15 +19,10 @@ RUN wget https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png && \
|
|||
mv big-image.png ./static && \
|
||||
mv video.mp4 ./static
|
||||
|
||||
# Download dependencies as a separate step to take advantage of Docker's caching.
|
||||
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
|
||||
# Leverage a bind mount to requirements.txt to avoid having to copy them into
|
||||
# into this layer.
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
--mount=type=bind,source=requirements.txt,target=requirements.txt \
|
||||
python -m pip install -r requirements.txt
|
||||
|
||||
# Expose the port that the application listens on.
|
||||
EXPOSE 5000
|
||||
|
||||
# Run the application.
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -38,4 +38,4 @@ def get_big_image():
|
|||
|
||||
@image_blueprint.route('/image/save-big-image', methods=['POST'])
|
||||
def save_image():
|
||||
pass
|
||||
image_service.save_image(request.files.get('file'))
|
||||
|
|
Binary file not shown.
|
@ -1,8 +1,5 @@
|
|||
from wand.image import Image
|
||||
|
||||
from static.image_helper import ImageHelper
|
||||
|
||||
|
||||
def box_blur_image_separable(image, blurred_image, radius_x, radius_y):
|
||||
pixels = image.get_pixels()
|
||||
blurred_pixels = blurred_image.get_pixels()
|
||||
|
@ -37,33 +34,23 @@ def save_image(file_stream):
|
|||
file.write(file_stream.read())
|
||||
file.close()
|
||||
|
||||
|
||||
class ImageService:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def box_blur_image(self, img, radius):
|
||||
temp_path = 'temp_image.png'
|
||||
img.save(temp_path)
|
||||
|
||||
with Image(filename=temp_path) as img:
|
||||
img.blur(radius, 2)
|
||||
blurred_temp_path = 'blurred_temp_image.png'
|
||||
img.save(filename='blurred_temp_image.png')
|
||||
return blurred_temp_path
|
||||
|
||||
with Image(filename=img) as image:
|
||||
image = image.blur(radius, 0)
|
||||
image = image.blur(0, radius)
|
||||
return image
|
||||
|
||||
def get_simple_image(self):
|
||||
with ImageHelper.SimpleImage as img:
|
||||
img = ImageHelper.SimpleImage
|
||||
simple_image = 'simple_image.png'
|
||||
img.save(filename='simple_image.png')
|
||||
return simple_image
|
||||
|
||||
with open("./static/small-image.png", "rb") as file:
|
||||
return file.read()
|
||||
|
||||
def get_big_image(self):
|
||||
with ImageHelper.BigImage as img:
|
||||
img = ImageHelper.BigImage
|
||||
big_image = 'big_image.png'
|
||||
img.save(filename='big_image.png')
|
||||
return big_image
|
||||
with open("./static/big-image.png", "rb") as file:
|
||||
return file.read()
|
||||
|
||||
def save_image(self, img):
|
||||
save_image(img)
|
||||
|
|
Binary file not shown.
|
@ -8,10 +8,7 @@ class ImageHelper:
|
|||
@staticmethod
|
||||
def load_images():
|
||||
ImageHelper.SimpleImage = Image(filename="./static/small-image.png")
|
||||
#ImageHelper.SimpleImage.save(filename="./static/small-image.png")
|
||||
|
||||
ImageHelper.BigImage = Image(filename="./static/big-image.png")
|
||||
#ImageHelper.BigImage.save(filename="./static/big-image.png")
|
||||
pass
|
||||
|
||||
ImageHelper.load_images()
|
|
@ -13,5 +13,5 @@ def download_file(url):
|
|||
return local_filename
|
||||
|
||||
def init():
|
||||
download_file('https://files.ivanch.me/api/public/dl/Dj0gkp-m/small-image.png')
|
||||
download_file('https://files.ivanch.me/api/public/dl/FqHEPM1Q/big-image.png')
|
||||
download_file('https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png')
|
||||
download_file('https://files.ivanch.me/api/public/dl/81Bkht5C/big-image.png')
|
Loading…
Reference in New Issue