gokaygokay commited on
Commit
9f4b6f2
·
1 Parent(s): c300ab5

joy_caption_2

Browse files
Files changed (1) hide show
  1. ui_components.py +4 -2
ui_components.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  from prompt_generator import PromptGenerator
3
  from huggingface_inference_node import LLMInferenceNode
4
- from caption_models import florence_caption, qwen_caption
5
  import random
6
  from prompt_generator import ARTFORM, PHOTO_TYPE, FEMALE_BODY_TYPES, MALE_BODY_TYPES, FEMALE_DEFAULT_TAGS, MALE_DEFAULT_TAGS, ROLES, HAIRSTYLES, FEMALE_CLOTHING, MALE_CLOTHING, PLACE, LIGHTING, COMPOSITION, POSE, BACKGROUND, FEMALE_ADDITIONAL_DETAILS, MALE_ADDITIONAL_DETAILS, PHOTOGRAPHY_STYLES, DEVICE, PHOTOGRAPHER, ARTIST, DIGITAL_ARTFORM
7
 
@@ -89,7 +89,7 @@ def create_interface():
89
  with gr.Accordion("Image and Caption", open=False):
90
  input_image = gr.Image(label="Input Image (optional)")
91
  caption_output = gr.Textbox(label="Generated Caption", lines=3)
92
- caption_model = gr.Radio(["Florence-2", "Qwen2-VL"], label="Caption Model", value="Florence-2")
93
  create_caption_button = gr.Button("Create Caption")
94
  add_caption_button = gr.Button("Add Caption to Prompt")
95
 
@@ -146,6 +146,8 @@ def create_interface():
146
  return florence_caption(image)
147
  elif model == "Qwen2-VL":
148
  return qwen_caption(image)
 
 
149
  return ""
150
 
151
  create_caption_button.click(
 
1
  import gradio as gr
2
  from prompt_generator import PromptGenerator
3
  from huggingface_inference_node import LLMInferenceNode
4
+ from caption_models import florence_caption, qwen_caption, joycaption
5
  import random
6
  from prompt_generator import ARTFORM, PHOTO_TYPE, FEMALE_BODY_TYPES, MALE_BODY_TYPES, FEMALE_DEFAULT_TAGS, MALE_DEFAULT_TAGS, ROLES, HAIRSTYLES, FEMALE_CLOTHING, MALE_CLOTHING, PLACE, LIGHTING, COMPOSITION, POSE, BACKGROUND, FEMALE_ADDITIONAL_DETAILS, MALE_ADDITIONAL_DETAILS, PHOTOGRAPHY_STYLES, DEVICE, PHOTOGRAPHER, ARTIST, DIGITAL_ARTFORM
7
 
 
89
  with gr.Accordion("Image and Caption", open=False):
90
  input_image = gr.Image(label="Input Image (optional)")
91
  caption_output = gr.Textbox(label="Generated Caption", lines=3)
92
+ caption_model = gr.Radio(["Florence-2", "Qwen2-VL", "JoyCaption"], label="Caption Model", value="Florence-2")
93
  create_caption_button = gr.Button("Create Caption")
94
  add_caption_button = gr.Button("Add Caption to Prompt")
95
 
 
146
  return florence_caption(image)
147
  elif model == "Qwen2-VL":
148
  return qwen_caption(image)
149
+ elif model == "JoyCaption":
150
+ return joycaption(image)
151
  return ""
152
 
153
  create_caption_button.click(