Anastasia Zimina commited on
Commit
a9221ec
·
1 Parent(s): 8535e45

moving style description to a file

Browse files
Files changed (2) hide show
  1. app.py +22 -43
  2. input_fields.json +9 -1
app.py CHANGED
@@ -65,31 +65,7 @@ input_fields = load_input_fields("input_fields.json")
65
  # Models
66
  models = input_fields.get("models")
67
  # Styles
68
-
69
- photography_techniques = [
70
- "Motion capture",
71
- "High-speed photography",
72
- "Close-up shot",
73
- "Bokeh",
74
- "Filmic",
75
- "Film grain",
76
- "Cinematic Haze",
77
- "Photorealistic"
78
- ]
79
-
80
-
81
- photography_styles = [
82
- "Portrait photography",
83
- "Product photography",
84
- "Fashion photography",
85
- "Wildlife photography",
86
- "Underwater photography",
87
- "Satellite imagery",
88
- "Action scene",
89
- "Cinematic shot",
90
- "Editorial photography",
91
- "Documentary style"
92
- ]
93
 
94
  # Environment
95
  weather_and_time_conditions = [
@@ -243,7 +219,7 @@ aspect_ratio_variations = [
243
  {'name': 'Vertical Shot (9:16)', 'description': 'Think of it as 16:9 flipped, ideal for portraits.'}
244
  ]
245
 
246
- welcome_text="[Photo Style] in [Photo Technique] of [Subject], set in a [Environment — time, weather, etc.] with a [Mood]. Include [Additional Details]. Emulate a [Specific Camera] with a [Lens Filter] and use [Shot Type]. Compose at [Camera Angle] from [Camera Position] perspective. Use [Lighting Conditions]."
247
  container_style = "border: 2px solid black; padding: 2rem; font-size: 16px;"
248
  html_formated_text=create_html_string(welcome_text, container_style=container_style)
249
 
@@ -288,24 +264,17 @@ with gr.Blocks() as demo:
288
  gr.Markdown(
289
  """
290
  # Let's combine a prompt for you!
 
 
 
 
 
291
  """
292
  )
293
  gr.HTML(value=html_formated_text)
294
 
295
  ui_base_model = gr.Radio(choices=models, value="Default", interactive=True,label="Model", info="Select a model you are building a prompt against. Each model has a custom syntax")
296
 
297
- gr.Markdown(
298
- """
299
- ## Style Descriptor
300
- """
301
- )
302
-
303
- with gr.Tab("Photography Type"):
304
- with gr.Row():
305
- with gr.Column():
306
- ui_photography_style = gr.Dropdown(choices=photography_styles, allow_custom_value=True, label="Photography Style", info="Select a photography style. You can specify multiple styles, and even add your own.")
307
- with gr.Column():
308
- ui_photography_technique = gr.Dropdown(choices=photography_techniques, allow_custom_value=True, label="Photography Type", info="Select a photography type. You can specify multiple types, and even add your own.")
309
  gr.Markdown(
310
  """
311
  ## Subject and Details
@@ -317,6 +286,19 @@ with gr.Blocks() as demo:
317
  ui_subject = gr.Textbox(label="Subject of prompt", placeholder="Type your subject", info="Type the subject of the prompt you are creating")
318
  with gr.Column():
319
  ui_details = gr.Textbox(label="Details", placeholder="more details", info="Add more details to the prompt")
 
 
 
 
 
 
 
 
 
 
 
 
 
320
 
321
  gr.Markdown(
322
  """
@@ -397,13 +379,11 @@ with gr.Blocks() as demo:
397
  with gr.Column(scale=3):
398
  result_prompt=gr.TextArea(label="Compiled Prompt", show_copy_button=True, interactive=True)
399
 
400
- def compile_prompt(photo_style, photo_technique, subject, time_weather, mood, details, camera_type, camera_specs, camera_angle, camera_position, shot_type, lens_filter, lighting, model, aspect_ratio):
401
  resulting_prompt = ""
402
  if photo_style:
403
  resulting_prompt += f"{photo_style} "
404
- if photo_technique:
405
- resulting_prompt += f"in {photo_technique} "
406
- if photo_technique or photo_style:
407
  resulting_prompt += "of "
408
  if subject:
409
  resulting_prompt += f"{subject}, "
@@ -434,7 +414,6 @@ with gr.Blocks() as demo:
434
  compile_prompt,
435
  inputs=[
436
  ui_photography_style,
437
- ui_photography_technique,
438
  ui_subject,
439
  ui_time_weather,
440
  ui_mood,
 
65
  # Models
66
  models = input_fields.get("models")
67
  # Styles
68
+ photography_styles = input_fields.get("photography_styles")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  # Environment
71
  weather_and_time_conditions = [
 
219
  {'name': 'Vertical Shot (9:16)', 'description': 'Think of it as 16:9 flipped, ideal for portraits.'}
220
  ]
221
 
222
+ welcome_text="[Photo Style] of [Subject], set in a [Environment — time, weather, etc.] with a [Mood]. Include [Additional Details]. Emulate a [Specific Camera] with a [Lens Filter] and use [Shot Type]. Compose at [Camera Angle] from [Camera Position] perspective. Use [Lighting Conditions]."
223
  container_style = "border: 2px solid black; padding: 2rem; font-size: 16px;"
224
  html_formated_text=create_html_string(welcome_text, container_style=container_style)
225
 
 
264
  gr.Markdown(
265
  """
266
  # Let's combine a prompt for you!
267
+
268
+ > There is so much out there, and you have to go find it. We wanted to bring everything together to make building prompts easier.
269
+ >
270
+ > \- *Will, Eclair, and Anastasia*
271
+
272
  """
273
  )
274
  gr.HTML(value=html_formated_text)
275
 
276
  ui_base_model = gr.Radio(choices=models, value="Default", interactive=True,label="Model", info="Select a model you are building a prompt against. Each model has a custom syntax")
277
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  gr.Markdown(
279
  """
280
  ## Subject and Details
 
286
  ui_subject = gr.Textbox(label="Subject of prompt", placeholder="Type your subject", info="Type the subject of the prompt you are creating")
287
  with gr.Column():
288
  ui_details = gr.Textbox(label="Details", placeholder="more details", info="Add more details to the prompt")
289
+
290
+ gr.Markdown(
291
+ """
292
+ ## Style Descriptor
293
+ """
294
+ )
295
+
296
+ with gr.Tab("Photography Type"):
297
+ with gr.Row():
298
+ with gr.Column():
299
+ ui_photography_style = gr.Dropdown(choices=photography_styles, allow_custom_value=True, label="Photography Style", info="Select a type of photography or add your own.")
300
+
301
+
302
 
303
  gr.Markdown(
304
  """
 
379
  with gr.Column(scale=3):
380
  result_prompt=gr.TextArea(label="Compiled Prompt", show_copy_button=True, interactive=True)
381
 
382
+ def compile_prompt(photo_style, subject, time_weather, mood, details, camera_type, camera_specs, camera_angle, camera_position, shot_type, lens_filter, lighting, model, aspect_ratio):
383
  resulting_prompt = ""
384
  if photo_style:
385
  resulting_prompt += f"{photo_style} "
386
+ if photo_style:
 
 
387
  resulting_prompt += "of "
388
  if subject:
389
  resulting_prompt += f"{subject}, "
 
414
  compile_prompt,
415
  inputs=[
416
  ui_photography_style,
 
417
  ui_subject,
418
  ui_time_weather,
419
  ui_mood,
input_fields.json CHANGED
@@ -1,3 +1,11 @@
1
  {
2
- "models": ["Midjourney", "Default"]
 
 
 
 
 
 
 
 
3
  }
 
1
  {
2
+ "models": ["Midjourney", "Default"],
3
+ "photography_styles": [
4
+ "Portrait photography",
5
+ "Product photography",
6
+ "Fashion photography",
7
+ "Cinematic shot",
8
+ "Film photography",
9
+ "High-speed photography"
10
+ ]
11
  }