ginipick commited on
Commit
9c8df4f
·
verified ·
1 Parent(s): aa08ecd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -334,15 +334,10 @@ class OpenAIGenerationNode:
334
 
335
  print(f"Prompt saved to {filename}")
336
 
337
- def generate(self, model, input_text, happy_talk, compress, compression_level, poster, custom_base_prompt=""):
338
  try:
339
- # 모델 매핑 - OpenAI는 모델이 다르므로 적절히 대체
340
- model_mapping = {
341
-
342
- "OpenAI": "gpt-4.1-mini"
343
- }
344
-
345
- openai_model = model_mapping.get(model, "gpt-4.1-mini") # 기본값은 gpt-4.1-mini
346
 
347
  default_happy_prompt = """Create a detailed visually descriptive caption of this description, which will be used as a prompt for a text to image AI system (caption only, no instructions like "create an image").Remove any mention of digital artwork or artwork style. Give detailed visual descriptions of the character(s), including ethnicity, skin tone, expression etc. Imagine using keywords for a still for someone who has aphantasia. Describe the image style, e.g. any photographic or art styles / techniques utilized. Make sure to fully describe all aspects of the cinematography, with abundant technical details and visual descriptions. If there is more than one image, combine the elements and characters from all of the images creatively into a single cohesive composition with a single background, inventing an interaction between the characters. Be creative in combining the characters into a single cohesive scene. Focus on two primary characters (or one) and describe an interesting interaction between them, such as a hug, a kiss, a fight, giving an object, an emotional reaction / interaction. If there is more than one background in the images, pick the most appropriate one. Your output is only the caption itself, no comments or extra formatting. The caption is in a single long paragraph. If you feel the images are inappropriate, invent a new scene / characters inspired by these. Additionally, incorporate a specific movie director's visual style and describe the lighting setup in detail, including the type, color, and placement of light sources to create the desired mood and atmosphere. Always frame the scene, including details about the film grain, color grading, and any artifacts or characteristics specific."""
348
 
@@ -498,8 +493,8 @@ def create_interface():
498
 
499
  with gr.Column(scale=2):
500
  with gr.Accordion("Prompt Generation with OpenAI", open=True):
501
- model = gr.Dropdown(["Mixtral", "Mistral", "Llama 3", "Mistral-Nemo"], label="Model Type", value="Llama 3")
502
- gr.HTML("<small>Note: Mixtral gpt-4, Mistral → gpt-4-turbo, Llama 3 → gpt-4.1-mini, Mistral-Nemo → gpt-4-turbo</small>")
503
  happy_talk = gr.Checkbox(label="Happy Talk", value=True)
504
  compress = gr.Checkbox(label="Compress", value=True)
505
  compression_level = gr.Radio(["soft", "medium", "hard"], label="Compression Level", value="hard")
@@ -533,9 +528,10 @@ def create_interface():
533
  outputs=[output]
534
  )
535
 
 
536
  generate_text_button.click(
537
  openai_node.generate,
538
- inputs=[model, output, happy_talk, compress, compression_level, poster, custom_base_prompt],
539
  outputs=text_output
540
  )
541
 
 
334
 
335
  print(f"Prompt saved to {filename}")
336
 
337
+ def generate(self, input_text, happy_talk, compress, compression_level, poster, custom_base_prompt=""):
338
  try:
339
+ # 고정 모델: gpt-4.1-mini
340
+ openai_model = "gpt-4.1-mini"
 
 
 
 
 
341
 
342
  default_happy_prompt = """Create a detailed visually descriptive caption of this description, which will be used as a prompt for a text to image AI system (caption only, no instructions like "create an image").Remove any mention of digital artwork or artwork style. Give detailed visual descriptions of the character(s), including ethnicity, skin tone, expression etc. Imagine using keywords for a still for someone who has aphantasia. Describe the image style, e.g. any photographic or art styles / techniques utilized. Make sure to fully describe all aspects of the cinematography, with abundant technical details and visual descriptions. If there is more than one image, combine the elements and characters from all of the images creatively into a single cohesive composition with a single background, inventing an interaction between the characters. Be creative in combining the characters into a single cohesive scene. Focus on two primary characters (or one) and describe an interesting interaction between them, such as a hug, a kiss, a fight, giving an object, an emotional reaction / interaction. If there is more than one background in the images, pick the most appropriate one. Your output is only the caption itself, no comments or extra formatting. The caption is in a single long paragraph. If you feel the images are inappropriate, invent a new scene / characters inspired by these. Additionally, incorporate a specific movie director's visual style and describe the lighting setup in detail, including the type, color, and placement of light sources to create the desired mood and atmosphere. Always frame the scene, including details about the film grain, color grading, and any artifacts or characteristics specific."""
343
 
 
493
 
494
  with gr.Column(scale=2):
495
  with gr.Accordion("Prompt Generation with OpenAI", open=True):
496
+ # 모델 선택 제거 안내 텍스트 변경
497
+ gr.HTML("<small>기본 모델: gpt-4.1-mini</small>")
498
  happy_talk = gr.Checkbox(label="Happy Talk", value=True)
499
  compress = gr.Checkbox(label="Compress", value=True)
500
  compression_level = gr.Radio(["soft", "medium", "hard"], label="Compression Level", value="hard")
 
528
  outputs=[output]
529
  )
530
 
531
+ # 인자에서 model 제거
532
  generate_text_button.click(
533
  openai_node.generate,
534
+ inputs=[output, happy_talk, compress, compression_level, poster, custom_base_prompt],
535
  outputs=text_output
536
  )
537