From 3f8a5d925e05efdb0388401c23c4bea847c9842f Mon Sep 17 00:00:00 2001 From: songtianlun Date: Wed, 9 Apr 2025 15:47:59 +0800 Subject: [PATCH] feat: refine DALL-E prompt structure for weather scenes - Update prompt structure to enhance clarity and detail. - Include specific requirements for realism and aesthetics in the images. - Emphasize photorealistic elements, lighting, and composition rules. These changes enable the AI to produce more accurate and visually appealing images based on weather conditions and city characteristics. It improves the instructions given to DALL-E, ensuring detailed and realistic output. --- app/services/ai_service.rb | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/app/services/ai_service.rb b/app/services/ai_service.rb index 07c7a46..48d0af4 100644 --- a/app/services/ai_service.rb +++ b/app/services/ai_service.rb @@ -71,26 +71,29 @@ class AiService state = city.state&.name || "" <<~PROMPT - Create a DALL-E 3 prompt for a weather scene in #{city.name}, #{state}, #{country}, #{region}. + Ultra-realistic photography of #{city.name}, #{state}, #{country}, #{region}. + captured with Phase One IQ4 150MP medium format camera, Hasselblad XCD 45mm f/4 lens. - Location Desc: #{city_desc} + **Scene Inspiration:** + #{city_desc} + (Use this description to inform the specific elements and mood of the scene). - Weather conditions: - - Temperature: #{weather_data[:temperature]}°C - - Weather: #{weather_data[:description]} - - Cloud cover: #{weather_data[:cloud]}% - - Time: #{weather_data[:time]} + **Weather Conditions to Depict:** + - Temperature Feel: Convey the atmosphere associated with #{weather_data[:temperature]}°C. + - Visible Weather: #{weather_data[:description]}. Show its effects on the environment (e.g., rain slicking streets, sun casting sharp shadows, fog softening distant objects). + - Sky & Light: Sky is #{weather_data[:cloud]}% cloud covered. Render the lighting accurately for the time: #{weather_data[:time]} (e.g., warm morning light, bright midday sun, soft afternoon light, dramatic sunset colors, twilight ambiance, or night scene lighting like streetlights). - Requirements: - - Feature iconic landmarks or architecture from #{city.name} - - Realistic style - - Weather conditions should be clearly visible - - Keep the picture clear and bright and avoid blurring - - Ensure the overall brightness is maintained, even in overcast conditions, by incorporating vibrant colors and soft lighting effects. - - If it’s a sunny day, enhance the brightness and warmth of the scene. - - Atmospheric and artistic composition + **Mandatory Requirements for Realism and Aesthetics:** + - **Style:** Photorealistic photograph, hyperrealistic, cinematic quality. Capture fine details, textures (e.g., wet pavement, brickwork, foliage), and accurate lighting. + - **Composition:** Atmospheric and artistic composition (e.g., rule of thirds, leading lines), creating depth and visual interest. Consider a natural eye-level perspective or a slightly elevated viewpoint for landscape/cityscape. + - **Landmarks/Architecture:** Feature iconic landmarks or characteristic architecture from #{city.name} as naturally integrated elements within the scene. + - **Clarity & Brightness:** Ensure the image is sharp, clear, and well-exposed. Avoid excessive blur or motion artifacts unless intentionally used for artistic effect (like long exposure for rain). + - **Lighting Enhancement:** + - Even in overcast conditions (high #{weather_data[:cloud]}), maintain visual appeal with soft, diffused light, ensuring details in shadows are visible and colors remain natural yet engaging. + - On sunny days (low #{weather_data[:cloud]}%), emphasize the brightness, warmth, contrast, and potentially lens flare for added realism. + - **Avoid:** Do NOT produce illustrations, paintings, sketches, anime, cartoons, or overly stylized digital art. The final image must look like a real photograph. - Generate a detailed, creative prompt that will produce a beautiful and realistic image. Directly output prompt words, no prefix and suffix words + **Output Format:** Directly output the complete, detailed DALL-E prompt string only. No introductory text, labels, or explanations. PROMPT end end