Skip to content

JimiKen/AI-png-to-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Image Prompt Runner / 图片 Prompt 批处理工具

A small Tkinter GUI that batches images through the OpenAI API with a shared prompt, then saves one text output per image. Designed for turning image OCR content into structured text (for example, HTML pages) while keeping folder structure and running in parallel.

一个基于 Tkinter 的小型图形界面工具,使用同一条提示词批量处理图片,并为 每张图片生成一个文本输出文件。适合把图片/OCR 内容转成结构化文本(例如 HTML 页面),同时保留目录结构并支持并发处理。

Features / 功能

  • Batch process images in a folder (optionally including subfolders).

  • Filter by file extension (default: .png).

  • Skip existing outputs to avoid rework.

  • Parallel mode with configurable concurrency.

  • Prompt loaded from Prompt.txt and saved in config.txt.

  • Output mirrors input folder structure under the chosen output base.

  • 批量处理文件夹内图片(可包含子目录)。

  • 按后缀过滤(默认 .png)。

  • 可跳过已生成的输出,避免重复处理。

  • 并发模式,可设置并发数。

  • 启动时读取 Prompt.txt,配置保存到 config.txt

  • 输出目录保持与输入相同的相对结构。

Requirements / 环境要求

  • Python 3.9+(推荐 3.10+)
  • openai Python SDK(v1)
  • Tkinter(Windows 上通常自带)

Install dependencies / 安装依赖:

pip install -U openai

Usage / 使用方法

Run the GUI / 启动界面:

python image_prompt_runner.py

In the app / 在界面中:

  1. Choose a root folder containing images. / 选择图片根目录。
  2. Set model, temperature, and max tokens. / 设置模型、温度和最大输出。
  3. Paste your prompt or use Prompt.txt. / 粘贴提示词或使用 Prompt.txt
  4. Set output base (default: outputs). / 设置输出根目录(默认 outputs)。
  5. Click "Start" (single-thread) or "Parallel". / 点击开始或并发处理。

Outputs are saved as .txt files with the same base name as the image and the same relative folder structure.

输出为 .txt 文件,文件名与图片一致,并保留相对目录结构。

Config and Prompt Files / 配置与提示词

  • config.txt is read on startup and saved by the GUI.

  • Prompt.txt (if present) loads the prompt area on startup.

  • 启动时读取 config.txt,也可在界面中保存配置。

  • 若存在 Prompt.txt,启动时会自动加载到提示词输入框。

config.txt stores OPENAI_API_KEY in plain text for convenience. Do not commit it to public repos. Remove the key or add config.txt to .gitignore before publishing.

密钥或将 config.txt 加入 .gitignore

Notes / 说明

  • If you see 429 rate limit errors, the tool retries with backoff.

  • The model is configurable; ensure it supports image input.

  • Output is plain text, one file per image.

  • 出现 429 限速时会自动重试并退避等待。

  • 模型可配置,请确保支持图像输入。

  • 输出为纯文本,每张图对应一个文件。

About

i want get a ai by myself

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages