hoang14's picture
Upload folder using huggingface_hub
ccfbb46 verified
Raw
History Blame Contribute Delete
2.25 kB
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Change directory to the workspace root where the script is located
cd "$(dirname "$0")"
echo "=== 1. Cleaning existing intermediate files ==="
rm -f report_architectural_inference.aux \
report_architectural_inference.log \
report_architectural_inference.tex \
report_architectural_inference.toc \
report_architectural_inference.pdf \
report_architectural_inference.html
rm -rf report_architectural_inference_files
echo "=== 2. Converting new/updated PNG images to JPEGs ==="
uv run python -c "
import os
from PIL import Image
output_dir = 'resources/task_vin'
if os.path.exists(output_dir):
for root, dirs, files in os.walk(output_dir):
for f in files:
if f.endswith('.png'):
png_path = os.path.join(root, f)
jpg_path = png_path[:-4] + '.jpg'
# Convert if JPG doesn't exist or is older than PNG (meaning PNG was updated)
if not os.path.exists(jpg_path) or os.path.getmtime(png_path) > os.path.getmtime(jpg_path):
try:
img = Image.open(png_path)
img_rgb = img.convert('RGB')
img_rgb.save(jpg_path, 'JPEG', quality=85)
print(f'Converted: {png_path} -> {jpg_path}')
except Exception as e:
print(f'Error converting {png_path}: {e}')
"
echo "=== 3. Rendering Quarto report to PDF ==="
quarto render report_architectural_inference.qmd --to pdf
echo "=== 4. Cleaning up compilation artifacts ==="
rm -f report_architectural_inference.aux \
report_architectural_inference.log \
report_architectural_inference.tex \
report_architectural_inference.toc \
report_architectural_inference.html
rm -rf report_architectural_inference_files
# Delete converted JPEGs from resources to prevent duplication
if [ -d "resources/task_vin" ]; then
echo "=== Removing temporary converted JPEG files ==="
find resources/task_vin -name "*.jpg" -type f -delete
fi
echo "=== Build Complete! report_architectural_inference.pdf has been generated successfully. ==="