Update app.py
Browse files
app.py
CHANGED
|
@@ -209,12 +209,20 @@ def stream_chat(input_image: Image.Image, caption_type: str, caption_tone: str,
|
|
| 209 |
prompt_str = CAPTION_TYPE_MAP[prompt_key][0].format(length=length, word_count=length)
|
| 210 |
|
| 211 |
if caption_type == "style_prompt":
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
|
| 219 |
# Debugging: Print the constructed prompt string
|
| 220 |
print(f"Constructed Prompt: {prompt_str}")
|
|
@@ -444,10 +452,10 @@ with gr.Blocks(theme="Hev832/Applio", css=css) as demo:
|
|
| 444 |
|
| 445 |
gr.Markdown("**Note:** Caption tone doesn't affect `rng-tags`, `training_prompt`, and `style_prompt`.")
|
| 446 |
|
| 447 |
-
run_button = gr.Button("Make My Caption!")
|
| 448 |
|
| 449 |
with gr.Column():
|
| 450 |
output_caption = gr.Textbox(label="Generated Caption")
|
|
|
|
| 451 |
|
| 452 |
# Container for advanced options
|
| 453 |
with gr.Column(visible=False) as advanced_options:
|
|
|
|
| 209 |
prompt_str = CAPTION_TYPE_MAP[prompt_key][0].format(length=length, word_count=length)
|
| 210 |
|
| 211 |
if caption_type == "style_prompt":
|
| 212 |
+
# Extract the key from the dropdown value
|
| 213 |
+
lens_type_key = lens_type.split(":")[0].strip() if lens_type else ""
|
| 214 |
+
film_stock_key = film_stock.split(":")[0].strip() if film_stock else ""
|
| 215 |
+
composition_style_key = composition_style.split(":")[0].strip() if composition_style else ""
|
| 216 |
+
lighting_aspect_key = lighting_aspect.split(":")[0].strip() if lighting_aspect else ""
|
| 217 |
+
special_technique_key = special_technique.split(":")[0].strip() if special_technique else ""
|
| 218 |
+
color_effect_key = color_effect.split(":")[0].strip() if color_effect else ""
|
| 219 |
+
|
| 220 |
+
prompt_str += f" Lens type: {lens_type_key} ({lens_types_info[lens_type_key]}). " if lens_type_key else ""
|
| 221 |
+
prompt_str += f"Film stock: {film_stock_key} ({film_stocks_info[film_stock_key]}). " if film_stock_key else ""
|
| 222 |
+
prompt_str += f"Composition style: {composition_style_key} ({composition_styles_info[composition_style_key]}). " if composition_style_key else ""
|
| 223 |
+
prompt_str += f"Lighting aspect: {lighting_aspect_key} ({lighting_aspects_info[lighting_aspect_key]}). " if lighting_aspect_key else ""
|
| 224 |
+
prompt_str += f"Special technique: {special_technique_key} ({special_techniques_info[special_technique_key]}). " if special_technique_key else ""
|
| 225 |
+
prompt_str += f"Color effect: {color_effect_key} ({color_effects_info[color_effect_key]})." if color_effect_key else ""
|
| 226 |
|
| 227 |
# Debugging: Print the constructed prompt string
|
| 228 |
print(f"Constructed Prompt: {prompt_str}")
|
|
|
|
| 452 |
|
| 453 |
gr.Markdown("**Note:** Caption tone doesn't affect `rng-tags`, `training_prompt`, and `style_prompt`.")
|
| 454 |
|
|
|
|
| 455 |
|
| 456 |
with gr.Column():
|
| 457 |
output_caption = gr.Textbox(label="Generated Caption")
|
| 458 |
+
run_button = gr.Button("Make My Caption!")
|
| 459 |
|
| 460 |
# Container for advanced options
|
| 461 |
with gr.Column(visible=False) as advanced_options:
|