Spaces:
Running
on
Zero
Running
on
Zero
Julian Bilcke
commited on
Commit
·
a0da14a
1
Parent(s):
3219aaf
up
Browse files
app.py
CHANGED
|
@@ -162,17 +162,22 @@ IMPORTANT INSTRUCTIONS:
|
|
| 162 |
1. Output ONLY a YAML list with exactly {num_scenes} items
|
| 163 |
2. Each item must have exactly two fields:
|
| 164 |
- caption: A detailed visual description of the scene (describe characters, clothing, location, action, expressions)
|
| 165 |
-
- dialogue:
|
| 166 |
3. For captions: Be very descriptive. Repeat character descriptions in each scene (appearance, clothes, etc.)
|
| 167 |
-
4. For dialogue:
|
|
|
|
|
|
|
|
|
|
| 168 |
5. Keep continuity between scenes to tell a coherent story
|
| 169 |
6. Make each scene visually distinct but connected to the narrative
|
| 170 |
|
| 171 |
Example output format:
|
| 172 |
- caption: "A young woman with long red hair wearing a blue detective coat stands in a dark alley, holding a magnifying glass up to examine mysterious glowing footprints on the wet pavement"
|
| 173 |
-
dialogue:
|
| 174 |
- caption: "The same red-haired woman in the blue coat backs away in shock as a massive shark fin emerges from a puddle in the alley, water splashing everywhere"
|
| 175 |
-
dialogue:
|
|
|
|
|
|
|
| 176 |
|
| 177 |
Generate exactly {num_scenes} scenes. Output ONLY the YAML list, no other text."""
|
| 178 |
|
|
@@ -803,9 +808,8 @@ def infer_single_auto(
|
|
| 803 |
|
| 804 |
# Add dialogue to the prompt if present
|
| 805 |
if dialogue and dialogue.strip():
|
| 806 |
-
#
|
| 807 |
-
|
| 808 |
-
styled_prompt = f"{styled_prompt}, speech bubble saying {dialogue_formatted}"
|
| 809 |
|
| 810 |
# Use style negative prompt if available, otherwise default
|
| 811 |
negative_prompt = style_negative_prompt if style_negative_prompt else " "
|
|
@@ -838,14 +842,6 @@ infer = infer_single_auto
|
|
| 838 |
# --- Examples and UI Layout ---
|
| 839 |
examples = [
|
| 840 |
"A capybara wearing a suit holding a sign that reads Hello World",
|
| 841 |
-
"一幅精致细腻的工笔画,画面中心是一株蓬勃生长的红色牡丹,花朵繁茂,既有盛开的硕大花瓣,也有含苞待放的花蕾,层次丰富,色彩艳丽而不失典雅。牡丹枝叶舒展,叶片浓绿饱满,脉络清晰可见,与红花相映成趣。一只蓝紫色蝴蝶仿佛被画中花朵吸引,停驻在画面中央的一朵盛开牡丹上,流连忘返,蝶翼轻展,细节逼真,仿佛随时会随风飞舞。整幅画作笔触工整严谨,色彩浓郁鲜明,展现出中国传统工笔画的精妙与神韵,画面充满生机与灵动之感。",
|
| 842 |
-
"一位身着淡雅水粉色交领襦裙的年轻女子背对镜头而坐,俯身专注地手持毛笔在素白宣纸上书写“通義千問”四个遒劲汉字。古色古香的室内陈设典雅考究,案头错落摆放着青瓷茶盏与鎏金香炉,一缕熏香轻盈升腾;柔和光线洒落肩头,勾勒出她衣裙的柔美质感与专注神情,仿佛凝固了一段宁静温润的旧时光。",
|
| 843 |
-
" 一个可抽取式的纸巾盒子,上面写着'Face, CLEAN & SOFT TISSUE'下面写着'亲肤可湿水',左上角是品牌名'洁柔',整体是白色和浅黄色的色调",
|
| 844 |
-
"手绘风格的水循环示意图,整体画面呈现出一幅生动形象的水循环过程图解。画面中央是一片起伏的山脉和山谷,山谷中流淌着一条清澈的河流,河流最终汇入一片广阔的海洋。山体和陆地上绘制有绿色植被。画面下方为地下水层,用蓝色渐变色块表现,与地表水形成层次分明的空间关系。太阳位于画面右上角,促使地表水蒸发,用上升的曲线箭头表示蒸发过程。云朵漂浮在空中,由白色棉絮状绘制而成,部分云层厚重,表示水汽凝结成雨,用向下箭头连接表示降雨过程。雨水以蓝色线条和点状符号表示,从云中落下,补充河流与地下水。整幅图以卡通手绘风格呈现,线条柔和,色彩明亮,标注清晰。背景为浅黄色纸张质感,带有轻微的手绘纹理。",
|
| 845 |
-
'一个会议室,墙上写着"3.14159265-358979-32384626-4338327950",一���小陀螺在桌上转动',
|
| 846 |
-
'一个咖啡店门口有一个黑板,上面写着通义千问咖啡,2美元一杯,旁边有个霓虹灯,写着阿里巴巴,旁边有个海报,海报上面是一个中国美女,海报下方写着qwen newbee',
|
| 847 |
-
"""A young girl wearing school uniform stands in a classroom, writing on a chalkboard. The text "Introducing Qwen-Image, a foundational image generation model that excels in complex text rendering and precise image editing" appears in neat white chalk at the center of the blackboard. Soft natural light filters through windows, casting gentle shadows. The scene is rendered in a realistic photography style with fine details, shallow depth of field, and warm tones. The girl's focused expression and chalk dust in the air add dynamism. Background elements include desks and educational posters, subtly blurred to emphasize the central action. Ultra-detailed 32K resolution, DSLR-quality, soft bokeh effect, documentary-style composition""",
|
| 848 |
-
"Realistic still life photography style: A single, fresh apple resting on a clean, soft-textured surface. The apple is slightly off-center, softly backlit to highlight its natural gloss and subtle color gradients—deep crimson red blending into light golden hues. Fine details such as small blemishes, dew drops, and a few light highlights enhance its lifelike appearance. A shallow depth of field gently blurs the neutral background, drawing full attention to the apple. Hyper-detailed 8K resolution, studio lighting, photorealistic render, emphasizing texture and form."
|
| 849 |
]
|
| 850 |
|
| 851 |
css = """
|
|
@@ -869,10 +865,10 @@ with gr.Blocks(css=css) as demo:
|
|
| 869 |
gr.HTML("""
|
| 870 |
<div id="logo-title">
|
| 871 |
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_logo.png" alt="Qwen-Image Logo" width="400" style="display: block; margin: 0 auto;">
|
| 872 |
-
<h2 style="font-style: italic;color: #5b47d1;margin-top: -33px !important;margin-left: 133px;">
|
| 873 |
</div>
|
| 874 |
""")
|
| 875 |
-
gr.Markdown("
|
| 876 |
with gr.Row():
|
| 877 |
prompt = gr.Text(
|
| 878 |
label="Prompt",
|
|
@@ -882,7 +878,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 882 |
)
|
| 883 |
with gr.Column(scale=0):
|
| 884 |
run_button = gr.Button("Generate page 1", variant="primary")
|
| 885 |
-
reset_button = gr.Button("
|
| 886 |
|
| 887 |
# New row for Style Preset and Page Layout
|
| 888 |
with gr.Row():
|
|
|
|
| 162 |
1. Output ONLY a YAML list with exactly {num_scenes} items
|
| 163 |
2. Each item must have exactly two fields:
|
| 164 |
- caption: A detailed visual description of the scene (describe characters, clothing, location, action, expressions)
|
| 165 |
+
- dialogue: Natural language description of what the character says/exclaims/shouts (can be empty string if no dialogue)
|
| 166 |
3. For captions: Be very descriptive. Repeat character descriptions in each scene (appearance, clothes, etc.)
|
| 167 |
+
4. For dialogue: Write it as a natural language action that will be added to the scene description
|
| 168 |
+
- Format: "The [character] says: [what they say]" or "The [character] exclaims: [what they exclaim]"
|
| 169 |
+
- DO NOT include character names in the dialogue text itself
|
| 170 |
+
- Use verbs like: says, exclaims, shouts, whispers, asks, replies, thinks
|
| 171 |
5. Keep continuity between scenes to tell a coherent story
|
| 172 |
6. Make each scene visually distinct but connected to the narrative
|
| 173 |
|
| 174 |
Example output format:
|
| 175 |
- caption: "A young woman with long red hair wearing a blue detective coat stands in a dark alley, holding a magnifying glass up to examine mysterious glowing footprints on the wet pavement"
|
| 176 |
+
dialogue: "The detective exclaims: These tracks aren't human!"
|
| 177 |
- caption: "The same red-haired woman in the blue coat backs away in shock as a massive shark fin emerges from a puddle in the alley, water splashing everywhere"
|
| 178 |
+
dialogue: "The detective shouts: OH NO, SHARKS IN THE CITY!"
|
| 179 |
+
- caption: "The red-haired detective in blue coat runs down the alley, looking back over her shoulder at the shark fin pursuing her through the puddles"
|
| 180 |
+
dialogue: "The detective thinks to herself: I need to warn everyone!"
|
| 181 |
|
| 182 |
Generate exactly {num_scenes} scenes. Output ONLY the YAML list, no other text."""
|
| 183 |
|
|
|
|
| 808 |
|
| 809 |
# Add dialogue to the prompt if present
|
| 810 |
if dialogue and dialogue.strip():
|
| 811 |
+
# Simply append the dialogue as it's already properly formatted from the LLM
|
| 812 |
+
styled_prompt = f"{styled_prompt}. {dialogue.strip()}"
|
|
|
|
| 813 |
|
| 814 |
# Use style negative prompt if available, otherwise default
|
| 815 |
negative_prompt = style_negative_prompt if style_negative_prompt else " "
|
|
|
|
| 842 |
# --- Examples and UI Layout ---
|
| 843 |
examples = [
|
| 844 |
"A capybara wearing a suit holding a sign that reads Hello World",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 845 |
]
|
| 846 |
|
| 847 |
css = """
|
|
|
|
| 865 |
gr.HTML("""
|
| 866 |
<div id="logo-title">
|
| 867 |
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_logo.png" alt="Qwen-Image Logo" width="400" style="display: block; margin: 0 auto;">
|
| 868 |
+
<h2 style="font-style: italic;color: #5b47d1;margin-top: -33px !important;margin-left: 133px;">AiComicFactory-GradioEdition</h2>
|
| 869 |
</div>
|
| 870 |
""")
|
| 871 |
+
gr.Markdown("This demo uses [Qwen-Image-Lightning](https://huggingface.co/lightx2v/Qwen-Image-Lightning). Hugigng Face PRO users can perform more generations.")
|
| 872 |
with gr.Row():
|
| 873 |
prompt = gr.Text(
|
| 874 |
label="Prompt",
|
|
|
|
| 878 |
)
|
| 879 |
with gr.Column(scale=0):
|
| 880 |
run_button = gr.Button("Generate page 1", variant="primary")
|
| 881 |
+
reset_button = gr.Button("Reset", variant="secondary")
|
| 882 |
|
| 883 |
# New row for Style Preset and Page Layout
|
| 884 |
with gr.Row():
|