1
0
Fork 0

update container format, now it runs the process to create bus poster and then it delete automatically

modulo-led
diegoalrv 2023-11-12 19:54:52 -03:00
parent 1261cadadb
commit b1418985f7
17 changed files with 23 additions and 17 deletions

View File

@ -6,15 +6,10 @@ WORKDIR /app
# Copia el archivo requirements.txt al contenedor
COPY requirements.txt requirements.txt
COPY app.py app.py
# Instala las dependencias
RUN pip install -r requirements.txt
RUN pip install -r requirements.txt --no-cache-dir
# Copia el archivo de configuración de Jupyter
COPY jupyter_notebook_config.py /root/.jupyter/
# Expone el puerto 8888 para Jupyter Notebook
EXPOSE 8888
# Ejecuta Jupyter Notebook cuando el contenedor se inicie
CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
# Ejecuta app.py
CMD ["python", "app.py"]

2
app.py
View File

@ -154,7 +154,7 @@ def main():
full_panel.add_image(poster2, (aprox((0.05)*width), aprox((0.5)*height)))
# full_panel.add_image(bm, (aprox(0.02*width),aprox((1/6)*height)))
full_panel.get_image()
full_panel.save_image('/app/data/output.png')
full_panel.save_image('/app/data/output/images/poster.png')
if __name__ == '__main__':
main()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -1,5 +1,4 @@
matplotlib
seaborn
plotly
opencv-python
jupyter
requests
Pillow
numpy

12
run_container.sh 100755
View File

@ -0,0 +1,12 @@
#!/bin/bash
# Rutas absolutas a las carpetas locales
project_folder_path=$(pwd)
data_path=$project_folder_path/data
scripts_path=$project_folder_path/scripts
assets_path=$project_folder_path/assets
# Ejecuta el contenedor con el enlace de carpeta local
docker run --rm -d -p 8888:8888 --name make_poster -v $data_path:/app/data -v $assets_path:/app/assets -v $scripts_path:/app/scripts bus_poster

View File

@ -5,7 +5,7 @@ from PIL import ImageDraw, ImageFont
from PIL import Image, ImageDraw, ImageFont
import matplotlib.pyplot as plt
import numpy as np
from MyDraw import MyDraw
from .MyDraw import MyDraw
class BusPoster(MyDraw):

View File

@ -65,7 +65,7 @@ class MyDraw():
def load_barlow(self, font_size=None):
# Ruta a la fuente TTF personalizada
font_path = "/app/data/Barlow-Medium.ttf"
font_path = "/app/assets/fonts/Barlow-Medium.ttf"
# Carga la fuente
if font_size is None:
self.font = ImageFont.truetype(font_path, self.prms['font_size'])

View File

@ -5,7 +5,7 @@ from PIL import ImageDraw, ImageFont
from PIL import Image, ImageDraw, ImageFont
import matplotlib.pyplot as plt
import numpy as np
from MyDraw import MyDraw
from .MyDraw import MyDraw
class TimeAnnouncement(MyDraw):