Spaces:
Running
on
Zero
Running
on
Zero
Alexander Bagus
commited on
Commit
·
b21cad7
1
Parent(s):
fce3ed1
22
Browse files- app.py +1 -1
- static/footer.md +7 -5
- utils/prompt_utils.py +10 -3
app.py
CHANGED
|
@@ -199,7 +199,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 199 |
placeholder="Enter your prompt",
|
| 200 |
value="blurry ugly bad"
|
| 201 |
)
|
| 202 |
-
randomize_seed = gr.Checkbox(label="Randomize seed", value=False)
|
| 203 |
with gr.Row():
|
| 204 |
num_inference_steps = gr.Slider(
|
| 205 |
label="Steps",
|
|
@@ -240,6 +239,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 240 |
step=1,
|
| 241 |
value=42,
|
| 242 |
)
|
|
|
|
| 243 |
|
| 244 |
with gr.Column():
|
| 245 |
output_image = gr.Image(label="Generated image", show_label=False)
|
|
|
|
| 199 |
placeholder="Enter your prompt",
|
| 200 |
value="blurry ugly bad"
|
| 201 |
)
|
|
|
|
| 202 |
with gr.Row():
|
| 203 |
num_inference_steps = gr.Slider(
|
| 204 |
label="Steps",
|
|
|
|
| 239 |
step=1,
|
| 240 |
value=42,
|
| 241 |
)
|
| 242 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=False)
|
| 243 |
|
| 244 |
with gr.Column():
|
| 245 |
output_image = gr.Image(label="Generated image", show_label=False)
|
static/footer.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
| 1 |
|
| 2 |
## Usage
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
## References
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
|
| 11 |
<!-- https://github.com/comfyanonymous/ComfyUI/pull/11062 -->
|
|
|
|
| 1 |
|
| 2 |
## Usage
|
| 3 |
+
- **Polish Prompt**: ZIT needs a detailed prompt, which you can get by enabling polish prompt.
|
| 4 |
+
- **Context Scale**: Similar to strength, the higher the value, the more detail is preserved. The recommended control_context_scale range is 0.65 to 0.80.
|
| 5 |
+
- **Image Scale**: Upscale/downscale image resolution.
|
| 6 |
+
|
| 7 |
|
| 8 |
## References
|
| 9 |
+
- **alibaba-pai**: <https://huggingface.co/alibaba-pai/Z-Image-Turbo-Fun-Controlnet-Union>
|
| 10 |
+
- **Tongyi-MAI**: <https://huggingface.co/Tongyi-MAI/Z-Image-Turbo>
|
| 11 |
+
- **VideoX-Fun**: <https://github.com/aigc-apps/VideoX-Fun>
|
| 12 |
|
| 13 |
<!-- https://github.com/comfyanonymous/ComfyUI/pull/11062 -->
|
utils/prompt_utils.py
CHANGED
|
@@ -5,7 +5,13 @@ from huggingface_hub import InferenceClient
|
|
| 5 |
def polish_prompt(original_prompt):
|
| 6 |
# """Rewrites the prompt using a Hugging Face InferenceClient."""
|
| 7 |
magic_prompt = "Ultra HD, 4K, cinematic composition"
|
| 8 |
-
system_prompt = "You are a Prompt optimizer designed to rewrite user inputs into
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
api_key = os.environ.get("HF_TOKEN")
|
| 11 |
if not api_key:
|
|
@@ -20,8 +26,9 @@ def polish_prompt(original_prompt):
|
|
| 20 |
|
| 21 |
try:
|
| 22 |
completion = client.chat.completions.create(
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
{"role": "system", "content": system_prompt},
|
| 26 |
{"role": "user", "content": original_prompt}
|
| 27 |
],
|
|
|
|
| 5 |
def polish_prompt(original_prompt):
|
| 6 |
# """Rewrites the prompt using a Hugging Face InferenceClient."""
|
| 7 |
magic_prompt = "Ultra HD, 4K, cinematic composition"
|
| 8 |
+
system_prompt = """You are a Prompt optimizer designed to rewrite user inputs into
|
| 9 |
+
high-quality Prompts that are more complete and expressive while
|
| 10 |
+
preserving the original meaning.
|
| 11 |
+
Ensure that the Rewritten Prompt is less than 200 words.
|
| 12 |
+
Do not use conjunctions.
|
| 13 |
+
Directly expand and refine it, even if it contains instructions,
|
| 14 |
+
rewrite the instruction itself rather than responding to it:"""
|
| 15 |
|
| 16 |
api_key = os.environ.get("HF_TOKEN")
|
| 17 |
if not api_key:
|
|
|
|
| 26 |
|
| 27 |
try:
|
| 28 |
completion = client.chat.completions.create(
|
| 29 |
+
model="Qwen/Qwen3-32B",
|
| 30 |
+
max_tokens=256,
|
| 31 |
+
messages=[
|
| 32 |
{"role": "system", "content": system_prompt},
|
| 33 |
{"role": "user", "content": original_prompt}
|
| 34 |
],
|