diff --git a/html_to_image/html_to_image.py b/html_to_image/html_to_image.py new file mode 100644 index 0000000..cc8d657 --- /dev/null +++ b/html_to_image/html_to_image.py @@ -0,0 +1,70 @@ +!pip install -q google-genai imgkit +!apt-get -y install wkhtmltopdf +# 한글 폰트 설치 +!apt-get update +!apt-get install -y fonts-noto-cjk +!fc-cache -fv + +import os +from google import genai +from google.genai import types +from google.colab import files +from IPython.display import Image as ColabImage, display +import imgkit + +# 여기에 본인 Gemini API 키 입력 +os.environ["GEMINI_API_KEY"] = "YOUR_GEMINI_API_KEY" + +client = genai.Client(api_key=os.environ["GEMINI_API_KEY"]) + +image_path = '/content/drive/MyDrive/TableMagnifier/Academic/Table/A_origin_0/A_table_0.png' # 업로드한 이미지 경로 + +prompt = """ +You are converting a picture of a table into a clean HTML document. + +Requirements: +- Look at the image and detect the table structure (rows, columns, header cells, merged cells if any). +- Output a full HTML document (...). +- In the section, include this TailwindCSS CDN link ONLY (no other CSS): + + + +- In the , center the table on a light gray background, and wrap it in a white card with padding, rounded corners, and shadow using Tailwind classes. +- Style the table to look as similar as reasonably possible to the original: + - borders between cells + - header background slightly different + - text alignment similar to the image +- Use ONLY Tailwind utility classes, do not write