Commit fb40507d authored by Мальцева Виктория Андреевна's avatar Мальцева Виктория Андреевна
Browse files

add dockerfile, dockerignore, README.md

parent 2087a311
No related merge requests found
Showing with 108 additions and 59 deletions
+108 -59
.dockerignore 0 → 100644
__pycache__/
*.pyc
*.pyo
*.pyd
*.db
*.log
*.sqlite3
uploads/
results/
.git/
.venv/
*.DS_Store
Dockerfile 0 → 100644
# Используем базовый образ Python
FROM python:3.10-slim
# Устанавливаем рабочую директорию
WORKDIR /app
# Копируем файл зависимостей
COPY requirements.txt .
# Устанавливаем зависимости
RUN pip install --no-cache-dir -r requirements.txt
# Копируем все файлы проекта в контейнер
COPY . .
# Устанавливаем дополнительные зависимости для обработки изображений
RUN apt-get update && \
apt-get install -y \
libjpeg-dev \
libpng-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Открываем порт для приложения
EXPOSE 5000
# Команда для запуска приложения
CMD ["python", "app.py"]
# Computer Graphics
# Мальцева Виктория Андреевна. Домашнее задание.
## Описание проекта
### Напишите программу для оценки качества сжатия фото дифференциальным методом: вычитанием сжатого изображения из оригинального. При этом, нужно оценить, в какой зоне изображения наблюдаются наибольшие искажения. Сжимайте изображение, чтобы добиться 40% качества. Для простоты возьмем сетку 4х4 и будем указывать номер зоны с максимальным уровнем артефактов. Программа должна обрабатывать папку с файлами и генерировать в результате веб-страницу, на которой поверх картинки размещается информация: имя файла, номер зоны, уровень помех в процентах от максимума.
На повышенную оценку разработайте пользовательский интерфейс, который позволит пользователю загружать изображения и обрабатывать их для оценки артефактов. Интерфейс должен предоставить предварительный просмотр обработанных изображений с наложенными результатами анализа (номер зоны и уровень искажения). Пользователь сможет скачать HTML-страницу с результатами анализа для всех обработанных изображений.
## Getting started
## Описание программы
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Программа разработана на языке Python с использованием веб-фреймворка Flask. Она позволяет загружать изображения, анализировать их после сжатия и визуализировать результаты на веб-странице.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Форматы изображений
## Add your files
Программа принимает изображения в следующих форматах:
- JPEG
- PNG
- CR2 (Canon Raw)
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
### Структура проекта
```
cd existing_repo
git remote add origin https://git.miem.hse.ru/vianmaltseva/computer-graphics-153.git
git branch -M master
git push -uf origin master
```
- `app.py`: Главный файл приложения, который содержит логику для обработки изображений и генерации результатов.
- `upload.html`: Шаблон HTML для загрузки изображений.
- `results.html`: Шаблон HTML для отображения результатов анализа.
- `requirements.txt`: Файл с зависимостями, необходимыми для работы приложения.
## Integrate with your tools
### Как работает программа
- [ ] [Set up project integrations](https://git.miem.hse.ru/vianmaltseva/computer-graphics-153/-/settings/integrations)
1. **Загрузка изображений**: Пользователь загружает одно или несколько изображений через веб-интерфейс.
2. **Сжатие изображений**: Изображения сжимаются до 40% качества с использованием формата JPEG.
3. **Анализ артефактов**: Программа анализирует искажения в изображениях и определяет зону с максимальными артефактами, разбивая изображения на сетку 4x4.
4. **Генерация HTML-страницы**: Результаты анализа сохраняются на HTML-странице, которая отображает имя файла, номер зоны и уровень помех в процентах от максимума.
## Collaborate with your team
### Запуск приложения
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
1. **Установите зависимости**: Убедитесь, что у вас установлен Python 3.6 или выше. Установите необходимые библиотеки с помощью:
## Test and Deploy
```bash
pip install -r requirements.txt
Use the built-in continuous integration in GitLab.
2. **Запустите приложение**: В терминале выполните команду:
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
```bash
python app.py
3. **Откройте браузер**: Перейдите по адресу http://127.0.0.1:5000.
***
## Как получить результат
# Editing this README
1. На главной странице выберите изображение для загрузки.
2. Нажмите кнопку "Загрузить" для начала обработки изображений.
3. После завершения анализа вы будете перенаправлены на страницу с результатами, где будет отображено имя файла, номер зоны с наибольшими искажениями и уровень помех в процентах от максимума.
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Ошибки и их решение
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
### Если возникли ошибки при загрузке файлов:
## Name
Choose a self-explaining name for your project.
- Убедитесь, что вы загружаете поддерживаемые форматы изображений (JPEG, PNG, cr2).
- Проверьте, что загружаемые файлы не повреждены.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Docker
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
### Создание Docker-образа
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
Для удобства развертывания проекта можно использовать Docker. Следуйте этим шагам, чтобы собрать и запустить контейнер:
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
1. Убедитесь, что у вас установлен Docker. Если он не установлен, загрузите его с [официального сайта Docker](https://www.docker.com/get-started).
2. Откройте терминал и перейдите в директорию с вашим проектом, где находится файл `Dockerfile`.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
3. Соберите Docker-образ, выполнив следующую команду:
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
```bash
docker build -t image-compression-app .
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
Здесь **image-compression-app** — это имя вашего образа.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
4. Запустите контейнер с вашим приложением:
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
```bash
docker run -p 5000:5000 image-compression-app
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
Это запустит ваше приложение в контейнере, и оно будет доступно по адресу http://127.0.0.1:5000.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
### .dockerignore
## License
For open source projects, say how it is licensed.
В проекте также присутствует файл .dockerignore, который помогает исключить ненужные файлы из контекста сборки Docker, тем самым уменьшая размер образа и увеличивая скорость сборки. Он исключает временные файлы, кэши и директории uploads/ и results/.
```bash
__pycache__/
*.pyc
*.pyo
*.pyd
*.db
*.log
*.sqlite3
uploads/
results/
.git/
.venv/
*.DS_Store
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment