| 1 | # Copyright (C) 2025 AIDC-AI |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | # See the License for the specific language governing permissions and |
| 11 | # limitations under the License. |
| 12 | |
| 13 | """ |
| 14 | Style conversion prompt |
| 15 | |
| 16 | For converting user's custom style description to image generation prompt. |
| 17 | """ |
| 18 | |
| 19 | |
| 20 | STYLE_CONVERSION_PROMPT = """Convert this style description into a detailed image generation prompt for Stable Diffusion/FLUX: |
| 21 | |
| 22 | Style Description: {description} |
| 23 | |
| 24 | Requirements: |
| 25 | - Focus on visual elements, colors, lighting, mood, atmosphere |
| 26 | - Be specific and detailed |
| 27 | - Use professional photography/art terminology |
| 28 | - Output ONLY the prompt in English (no explanations) |
| 29 | - Keep it under 100 words |
| 30 | - Use comma-separated descriptive phrases |
| 31 | |
| 32 | Image Prompt:""" |
| 33 | |
| 34 | |
| 35 | def build_style_conversion_prompt(description: str) -> str: |
| 36 | """ |
| 37 | Build style conversion prompt |
| 38 | |
| 39 | Converts user's custom style description (in any language) to an English |
| 40 | image generation prompt suitable for Stable Diffusion/FLUX models. |
| 41 | |
| 42 | Args: |
| 43 | description: User's style description in any language |
| 44 | |
| 45 | Returns: |
| 46 | Formatted prompt |
| 47 | |
| 48 | Example: |
| 49 | >>> build_style_conversion_prompt("赛博朋克风格,霓虹灯,未来感") |
| 50 | # Returns prompt that will convert to: "cyberpunk style, neon lights, futuristic..." |
| 51 | """ |
| 52 | return STYLE_CONVERSION_PROMPT.format(description=description) |
| 53 | |
| 54 |