AsifBridge commited on
Commit
8fb8ccf
·
verified ·
1 Parent(s): 1be5e8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +106 -10
app.py CHANGED
@@ -1,7 +1,7 @@
1
  # Import libraries
2
  import gradio as gr
3
 
4
- # Define all dropdown options exactly as they were in the original code
5
  quality_options = [
6
  "", "Cinematic Quality", "Hyper Realistic Quality", "VHS Quality", "Super 8 Quality", "HD Quality", "4K Quality", "8K Quality", "Film Grain Quality",
7
  "Vintage Quality", "Polaroid Quality", "Black and White Quality", "Sepia Quality", "HDR Quality", "Lomo Quality", "Soft Focus Quality",
@@ -30,16 +30,94 @@ style_options = [
30
  "Stencil Art Style", "Concept Art Style", "Ukiyo-e Style", "Pop Surrealism Style", "Constructivism Style"
31
  ]
32
 
33
- # Continue defining other dropdown lists as in the original code
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
- # Define the function to generate cinematic prompts with user input as the first line
36
  def generate_prompts(
37
  quality, daytime, nighttime, indoor_location, outdoor_location, sky_option, sun_position, camera_position, lighting_preset, color_scheme, style, black_and_white, lighting_mood,
38
  emotional_mood, camera_lens, camera_filter, cinematic_blur, focus_option,
39
  key_light_position, film_grain, aperture, iso, shutter_speed, user_text
40
  ):
41
- # Add user_text as the first component in the core_prompt without the label "User Custom Prompt:"
42
- core_prompt = ", ".join([user_text] + [component for component in [quality, daytime, nighttime, indoor_location, outdoor_location, sky_option, sun_position, camera_position, lighting_preset, color_scheme, style, black_and_white, lighting_mood, emotional_mood, camera_lens, camera_filter, cinematic_blur, focus_option, key_light_position, film_grain, aperture, iso, shutter_speed] if component])
43
 
44
  midjourney_note = f"Visualize an elaborate canvas where colors are vibrant, shapes are exaggerated, and textures pop from the surface. In '{core_prompt}', light interacts with every element, casting dramatic shadows and bringing surreal clarity."
45
 
@@ -51,14 +129,32 @@ def generate_prompts(
51
 
52
  return core_prompt, midjourney_note, luma_note, runway_note, klingai_note
53
 
54
- # Set up Gradio Interface
55
  gr.Interface(
56
  fn=generate_prompts,
57
  inputs=[
58
  gr.Dropdown(quality_options, label="Quality"),
59
- gr.Dropdown(color_schemes, label="Color Scheme"),
60
- gr.Dropdown(style_options, label="Style"),
61
- # Add other dropdowns and Textbox for User Custom Prompt as in the original code
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  gr.Textbox(label="User Custom Prompt")
63
  ],
64
  outputs=[
@@ -69,7 +165,7 @@ gr.Interface(
69
  gr.Textbox(label="KlingAI Scene Description")
70
  ],
71
  title="Cinematic Prompt Generator",
72
- description="Generate prompts and scene descriptions for cinematic AI tools based on cinematic attributes."
73
  ).launch()
74
 
75
 
 
1
  # Import libraries
2
  import gradio as gr
3
 
4
+ # Define all dropdown options with blank options where requested
5
  quality_options = [
6
  "", "Cinematic Quality", "Hyper Realistic Quality", "VHS Quality", "Super 8 Quality", "HD Quality", "4K Quality", "8K Quality", "Film Grain Quality",
7
  "Vintage Quality", "Polaroid Quality", "Black and White Quality", "Sepia Quality", "HDR Quality", "Lomo Quality", "Soft Focus Quality",
 
30
  "Stencil Art Style", "Concept Art Style", "Ukiyo-e Style", "Pop Surrealism Style", "Constructivism Style"
31
  ]
32
 
33
+ black_and_white_options = [
34
+ "", "Grey Dots", "Black Dots", "Black Lines", "Grey Lines", "Black and White Cut Design", "Black and White Gradient", "Checkerboard", "Striped",
35
+ "Crosshatched", "Polka Dots", "Pinstripes", "Halftone Dots", "Diagonal Stripes", "Grid", "Speckled", "Zebra Stripes", "Pixelated", "Chevron",
36
+ "Argyle", "Plaid", "Ink Wash", "Monochrome Gradient", "Abstract Shapes", "Minimalist Shapes", "Brush Strokes", "Charcoal Lines", "Rough Texture",
37
+ "Smooth Gradient", "Geometric Patterns", "Mosaic", "Noise Texture", "Soft Gradient", "High Contrast", "Low Contrast", "Monochrome Blobs",
38
+ "Splattered Ink", "Outlined Shapes", "Fine Lines", "Thick Lines", "Gradient Lines", "Gradient Dots", "Layered Shapes", "Dot Matrix", "Stencil",
39
+ "Crossed Lines", "Hand-Drawn Doodle", "Grayscale Grunge", "Monochrome Silhouettes", "Pop Art Black and White"
40
+ ]
41
+
42
+ lighting_moods = [
43
+ "", "Warm and Inviting", "Mystical", "Dramatic", "Gritty", "Soft and Dreamy", "High Contrast", "Ethereal", "Dark and Moody", "Vibrant",
44
+ "Natural", "Subdued", "Harsh", "Backlit", "Side Lit", "Front Lit", "Golden Hour Glow", "Cool Blue Tone", "Sunset Lighting",
45
+ "Morning Soft Light", "Afternoon Brightness", "Overcast Mood", "Bright and Cheerful", "Shadowed", "Silhouetted", "Ambient Glow",
46
+ "Reflective", "Underlit", "Top Lit", "Foggy Atmosphere", "Glowing", "Spotlight Effect", "Dynamic Shadows", "Neon Glow", "Soft Shadowed",
47
+ "Sharp Shadow", "Studio Light", "Stage Spotlight", "Vintage Glow", "High Key", "Low Key", "Candlelight Warmth", "Fiery",
48
+ "Haunted Vibe", "Retro Lighting", "Soft Focus", "Crystal Clear", "Bouncing Light", "Mirror Reflection", "Rainy Day Shadows"
49
+ ]
50
+
51
+ emotional_moods = [
52
+ "", "Romantic", "Suspenseful", "Melancholic", "Joyful", "Nostalgic", "Tense", "Eerie", "Intense", "Hopeful", "Whimsical",
53
+ "Serene", "Foreboding", "Playful", "Calm", "Enigmatic", "Triumphant", "Anxious", "Lonely", "Peaceful", "Angry", "Excited",
54
+ "Passionate", "Reflective", "Sad", "Uplifting", "Grateful", "Determined", "Rebellious", "Mysterious"
55
+ ]
56
+
57
+ camera_filters = [
58
+ "", "Tiffen Pro-Mist", "Schneider Hollywood Black Magic", "Tiffen Glimmerglass", "Formatt Hitech ND", "Schneider Tru-Pol",
59
+ "Hoya IRND", "B+W 812 Warming", "Tiffen Low Contrast", "IMAX ND", "Schneider Classic Soft", "Polarizer Filter",
60
+ "UV Filter", "ND Filter", "Gradient Filter", "Warm Filter", "Cool Filter", "Star Filter", "Sepia Filter",
61
+ "Soft Focus Filter"
62
+ ]
63
+
64
+ cinematic_blurs = [
65
+ "", "Gaussian Blur", "Motion Blur", "Bokeh Blur", "Radial Blur", "Tilt-Shift Blur", "Zoom Blur", "Lens Blur",
66
+ "Directional Blur", "Depth of Field Blur", "Anamorphic Blur", "Foggy Blur", "Defocus Blur", "Background Blur",
67
+ "Dynamic Blur", "Smooth Blur", "Soft Focus Blur", "Intense Blur", "Subtle Blur", "Artistic Blur"
68
+ ]
69
+
70
+ focus_options = [
71
+ "", "Deep Focus", "Shallow Focus", "Soft Focus", "Split Focus", "Rack Focus", "Selective Focus", "Macro Focus",
72
+ "Infinity Focus", "Zone Focus", "Follow Focus", "Sharp Focus", "Blurred Background", "Foreground Focus",
73
+ "Extreme Close-Up Focus", "Full Frame Focus", "Manual Focus", "Center Focus", "Dynamic Focus", "Shifted Focus"
74
+ ]
75
+
76
+ key_light_positions = [
77
+ "", "Front Light", "Side Light", "Back Light", "Top Light", "Bottom Light", "45-Degree High", "Overhead Light",
78
+ "Three-Quarter Front", "Edge Light", "Diagonal Back", "Split Light", "Rembrandt Light", "Loop Light",
79
+ "Butterfly Light", "Cross Light", "Soft Key Light", "Hard Key Light", "Ambient Light", "Natural Light"
80
+ ]
81
+
82
+ film_grain_options = [
83
+ "", "Fine Grain", "Medium Grain", "Coarse Grain", "Color Grain", "Monochrome Grain", "Soft Grain",
84
+ "Sharp Grain", "Natural Grain", "Dense Grain", "Minimal Grain", "Vintage Grain", "Heavy Grain",
85
+ "Textured Grain", "Smooth Grain", "Digital Grain", "High ISO Grain", "Classic Film Grain",
86
+ "Subtle Grain", "Intense Grain"
87
+ ]
88
+
89
+ aperture_settings = [
90
+ "", "f/1.4", "f/2", "f/2.8", "f/4", "f/5.6", "f/8", "f/11", "f/16", "f/22", "f/32", "f/0.95",
91
+ "f/1.8", "f/3.5", "f/6.3", "f/7.1", "f/9", "f/10", "f/13", "f/18"
92
+ ]
93
+
94
+ iso_settings = [
95
+ "", "ISO 100", "ISO 200", "ISO 400", "ISO 800", "ISO 1600", "ISO 3200", "ISO 6400", "ISO 12800",
96
+ "ISO 25600", "ISO 51200", "ISO 50", "ISO 640", "ISO 125", "ISO 160", "ISO 320", "ISO 250",
97
+ "ISO 1250", "ISO 20000", "ISO 102400"
98
+ ]
99
+
100
+ shutter_speeds = [
101
+ "", "1/1000", "1/500", "1/250", "1/125", "1/60", "1/30", "1/15", "1/8", "1/4", "1/2",
102
+ "1", "2", "4", "8", "15", "30", "1/4000", "1/8000", "Bulb"
103
+ ]
104
+
105
+ camera_lenses = [
106
+ "", "ARRI Signature Prime", "Cooke S4/i Prime", "Panavision Primo", "Zeiss Master Prime", "Leica Summilux-C", "Canon K35", "Hawk V-Lite", "Angenieux Optimo",
107
+ "IMAX Hasselblad", "Sony CineAlta", "Anamorphic Lens", "Ultra Prime Lens", "Vista Vision Lens", "Zeiss Supreme Prime", "Atlas Orion Anamorphic", "RED Monstro",
108
+ "Panasonic Varicam Lens", "ARRI Ultra Wide", "Fujinon Cine Zoom", "Sigma Cine Prime", "Canon CN-E Prime", "Tokina Cinema Vista", "Leica M 0.8", "Xeen CF Lens"
109
+ ]
110
+
111
+ daytime_options = ["", "Early Morning", "Morning", "Late Morning", "Noon", "Early Afternoon", "Afternoon", "Late Afternoon", "Golden Hour", "Pre-Sunset", "Sunset", "After Sunset", "Twilight"]
112
+ nighttime_options = ["", "Dusk", "Early Evening", "Evening", "Late Evening", "Night", "Late Night", "Blue Hour", "Midnight", "Pre-Dawn", "Predawn Twilight", "First Light", "Dawn"]
113
 
114
+ # Define function to generate cinematic prompts for each model
115
  def generate_prompts(
116
  quality, daytime, nighttime, indoor_location, outdoor_location, sky_option, sun_position, camera_position, lighting_preset, color_scheme, style, black_and_white, lighting_mood,
117
  emotional_mood, camera_lens, camera_filter, cinematic_blur, focus_option,
118
  key_light_position, film_grain, aperture, iso, shutter_speed, user_text
119
  ):
120
+ core_prompt = ", ".join([component for component in [quality, daytime, nighttime, indoor_location, outdoor_location, sky_option, sun_position, camera_position, lighting_preset, color_scheme, style, black_and_white, lighting_mood, emotional_mood, camera_lens, camera_filter, cinematic_blur, focus_option, key_light_position, film_grain, aperture, iso, shutter_speed, user_text] if component])
 
121
 
122
  midjourney_note = f"Visualize an elaborate canvas where colors are vibrant, shapes are exaggerated, and textures pop from the surface. In '{core_prompt}', light interacts with every element, casting dramatic shadows and bringing surreal clarity."
123
 
 
129
 
130
  return core_prompt, midjourney_note, luma_note, runway_note, klingai_note
131
 
132
+ # Set up Gradio Interface with explanations
133
  gr.Interface(
134
  fn=generate_prompts,
135
  inputs=[
136
  gr.Dropdown(quality_options, label="Quality"),
137
+ gr.Dropdown(daytime_options, label="Daytime"),
138
+ gr.Dropdown(nighttime_options, label="Nighttime"),
139
+ gr.Dropdown(["", "Conference Hall", "Bedroom", "Lounge", "Kitchen", "Living Room", "Bathroom", "Office"], label="Indoor Location"),
140
+ gr.Dropdown(["", "Mountain", "Grassland", "Village", "City", "Beach", "Forest", "Desert", "Lake", "Ocean", "River", "Valley", "Cliff", "Canyon", "Garden", "Park", "Bridge", "Street Market", "Harbor", "Meadow", "Island", "Farm", "Field of Flowers", "Swamp", "Volcano", "Waterfall"], label="Outdoor Location"),
141
+ gr.Dropdown(["", "Clear Sky", "Cloudy Sky", "Stormy Sky", "Overcast", "Sunset Sky", "Sunrise Sky", "Twilight", "Starlit Sky", "Moonlit Sky", "Partly Cloudy", "Hazy Sky", "Foggy", "Blue Sky", "Aurora Borealis", "Dramatic Clouds"], label="Sky Condition"),
142
+ gr.Dropdown(["", "Directly Overhead", "Low in the East", "Low in the West", "High in the East", "High in the West", "Golden Hour", "Setting in the Horizon", "Rising in the Horizon", "Directly in Front", "Directly Behind", "Scattered Rays", "Soft Diffuse", "Hazy Sun", "Bright and Sharp", "Glimmering"], label="Sun Position"),
143
+ gr.Dropdown(["", "Eye Level", "High Angle", "Low Angle", "Overhead", "Bird's Eye View", "Worm's Eye View", "Dutch Angle", "Close-Up", "Wide Shot", "Medium Shot", "Extreme Close-Up", "Over-the-Shoulder", "Point-of-View", "Tilted", "Side Angle"], label="Camera Position", info="Choose the camera perspective to convey different moods and scales."),
144
+ gr.Dropdown(lighting_moods, label="Lighting Mood", info="Select lighting to enhance the emotional tone and atmosphere."),
145
+ gr.Dropdown(color_schemes, label="Color Scheme", info="Choose a color scheme to define the visual palette and mood."),
146
+ gr.Dropdown(style_options, label="Style", info="Select a style to influence the overall aesthetic or era."),
147
+ gr.Dropdown(black_and_white_options, label="Black and White", info="Pick a pattern or effect to convey texture in black and white."),
148
+ gr.Dropdown(emotional_moods, label="Emotional Mood", info="Select the intended emotional undertone of the scene."),
149
+ gr.Dropdown(camera_lenses, label="Camera Lens", info="Choose a lens type to control perspective, depth, and focus."),
150
+ gr.Dropdown(camera_filters, label="Camera Filter", info="Apply a filter for color correction or atmospheric effects."),
151
+ gr.Dropdown(cinematic_blurs, label="Cinematic Blur", info="Select a blur type to emphasize focal points or create motion."),
152
+ gr.Dropdown(focus_options, label="Focus Option", info="Choose a focus setting to direct viewer attention."),
153
+ gr.Dropdown(key_light_positions, label="Key Light Position", info="Select key lighting to shape contrast and visibility."),
154
+ gr.Dropdown(film_grain_options, label="Film Grain", info="Add grain for texture, age, or retro effects."),
155
+ gr.Dropdown(aperture_settings, label="Aperture", info="Control depth of field with aperture settings."),
156
+ gr.Dropdown(iso_settings, label="ISO", info="Adjust ISO for sensitivity and grain effects."),
157
+ gr.Dropdown(shutter_speeds, label="Shutter Speed", info="Control motion blur and exposure with shutter speed."),
158
  gr.Textbox(label="User Custom Prompt")
159
  ],
160
  outputs=[
 
165
  gr.Textbox(label="KlingAI Scene Description")
166
  ],
167
  title="Cinematic Prompt Generator",
168
+ description="Generate prompts and scene descriptions for Midjourney, Luma, Runway, and Kling AI based on cinematic attributes."
169
  ).launch()
170
 
171