explaingit

hunyuan-promptenhancer/promptenhancer

Analysis updated 2026-07-03

3,677PythonAudience · researcherComplexity · 3/5Setup · hard

TLDR

A Python tool from Tencent that rewrites your short or vague image descriptions into detailed, structured prompts so AI image generators produce better results.

Mindmap

mindmap
  root((promptenhancer))
    What it does
      Rewrite image prompts
      Text-to-image mode
      Image-to-image mode
    Model sizes
      7B model 8GB GPU
      32B model 32GB GPU
      Quantized 32B variants
    Input support
      English prompts
      Chinese prompts
    Try it
      Python API
      Gradio web demo
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Improve AI-generated images by automatically rewriting a rough text description into a more detailed, structured prompt before sending it to a generation model.

USE CASE 2

Enhance an image editing instruction by providing both the instruction and an existing image so the tool sharpens the description using the image's visual content.

USE CASE 3

Try prompt enhancement without any code by using the Gradio web demo on Hugging Face Spaces.

What is it built with?

PythonPyTorch

How does it compare?

hunyuan-promptenhancer/promptenhancerdataelement/clawithganymedenil/document.ai
Stars3,6773,6773,675
LanguagePythonPythonPython
Setup difficultyhardmoderatemoderate
Complexity3/54/53/5
Audienceresearcherdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires a GPU with at least 8GB of memory for the 7B model, models must be downloaded from Hugging Face before use.

License details not mentioned in the explanation.

In plain English

PromptEnhancer is a Python tool from Tencent Hunyuan that rewrites text descriptions before sending them to AI image generation systems. When you want to create an image with an AI tool, the quality of the result depends heavily on how clearly and specifically you describe what you want. PromptEnhancer takes a short or loosely worded description, analyzes it, and produces a more structured and detailed version that tends to yield better images from generation models. The tool has two modes. In text-to-image mode, it takes a written prompt and rewrites it into a clearer, more detailed form while keeping the original intent. In image-to-image mode, it also accepts an existing image alongside a written instruction, and it uses the visual content of that image to sharpen the editing instruction before it is passed to a generation model. Two model sizes are available. The 7B model, which requires about 8 gigabytes of GPU memory and weighs 13 gigabytes to download, is the recommended starting point for most users. The 32B model offers higher output quality but needs at least 32 gigabytes of GPU memory and 64 gigabytes of storage. For users with less memory, quantized versions of the 32B model are also available at 20, 27, and 35 gigabytes, with the quality degrading only slightly at the smaller sizes. Installation uses pip with a requirements file. Models are downloaded from Hugging Face using their command-line tool. The Python API for using the enhancer is straightforward: you initialize it with a model path, call a predict method with your prompt, and receive the rewritten version as a string. Both Chinese and English prompts are accepted. The project was accepted to CVPR 2026 and includes a benchmark dataset called T2I-Keypoints-Eval for measuring how well prompt rewriting improves image generation results. A Gradio web demo is available on Hugging Face Spaces for trying it without writing any code.

Copy-paste prompts

Prompt 1
Show me how to install PromptEnhancer and use the Python API to rewrite a short image description into a more detailed prompt for a text-to-image model.
Prompt 2
How do I download the 7B PromptEnhancer model from Hugging Face and run it locally to improve my image generation prompts?
Prompt 3
What is the difference between the 7B and 32B PromptEnhancer models, and which should I use if I have 16GB of GPU memory?
Prompt 4
How do I use PromptEnhancer in image-to-image mode by passing both a written instruction and an existing image to sharpen the editing prompt?

Frequently asked questions

What is promptenhancer?

A Python tool from Tencent that rewrites your short or vague image descriptions into detailed, structured prompts so AI image generators produce better results.

What language is promptenhancer written in?

Mainly Python. The stack also includes Python, PyTorch.

What license does promptenhancer use?

License details not mentioned in the explanation.

How hard is promptenhancer to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is promptenhancer for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub hunyuan-promptenhancer on gitmyhub

Verify against the repo before relying on details.