prithivMLmods commited on
Commit
94bd8c8
·
verified ·
1 Parent(s): da3da8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -19
app.py CHANGED
@@ -27,7 +27,7 @@ qwen_model = Qwen2VLForConditionalGeneration.from_pretrained(
27
  qwen_processor = AutoProcessor.from_pretrained("prithivMLmods/JSONify-Flux", trust_remote_code=True)
28
 
29
  # Prompt Enhancer
30
- enhancer_long = pipeline("summarization", model="gokaygokay/Lamini-Prompt-Enchance-Long", device=device)
31
 
32
  MAX_SEED = np.iinfo(np.int32).max
33
  MAX_IMAGE_SIZE = 2048
@@ -138,36 +138,33 @@ title = """<h1 align="center">FLUX.1-dev with Qwen2VL Captioner and Prompt Enhan
138
  <p><center>
139
  <a href="https://huggingface.co/black-forest-labs/FLUX.1-dev" target="_blank">[FLUX.1-dev Model]</a>
140
  <a href="https://huggingface.co/prithivMLmods/JSONify-Flux" target="_blank">[JSONify Flux Model]</a>
141
- <a href="https://huggingface.co/gokaygokay/Lamini-Prompt-Enchance-Long" target="_blank">[Prompt Enhancer Long]</a>
142
  <p align="center">Create long prompts from images or enhance your short prompts with prompt enhancer</p>
143
  </center></p>
144
  """
145
 
146
  with gr.Blocks(css=custom_css) as demo:
 
147
 
148
- # Sidebar with About details
149
  with gr.Sidebar(label="Parameters", open=True):
150
  gr.Markdown(
151
  """
152
  ### About
153
 
154
- #### FLUX.1-Dev
155
- FLUX.1 [dev] is a 12 billion parameter rectified flow transformer capable of generating images from text descriptions.
156
- FLUX.1 [dev] is an open-weight, guidance-distilled model for non-commercial applications. Directly distilled from FLUX.1 [pro], FLUX.1 [dev] obtains similar quality and prompt adherence capabilities, while being more efficient than a standard model of the same size.
157
- [FLUX.1-dev on Hugging Face](https://huggingface.co/black-forest-labs/FLUX.1-dev)
158
 
159
  #### JSONify-Flux
160
- JSONify-Flux is a multimodal image-text model based on the dataset of flux-generated images and architectures and built upon the Qwen2VL architecture. The JSON-base instruction has been manually removed to avoid JSON formatted captions.
161
- [JSONify-Flux on Hugging Face](https://huggingface.co/prithivMLmods/JSONify-Flux)
162
 
163
  #### t5-Flan-Prompt-Enhance
164
- t5-Flan-Prompt-Enhance is a prompt summarization model based on flux synthetic prompts designed to enhance the richness of prompt details.
165
- [t5-Flan-Prompt-Enhance on Hugging Face](https://huggingface.co/prithivMLmods/t5-Flan-Prompt-Enhance)
166
  """
167
  )
168
 
169
- gr.HTML(title)
170
-
171
  with gr.Row():
172
  with gr.Column(scale=1):
173
  with gr.Group(elem_classes="input-group"):
@@ -181,15 +178,15 @@ with gr.Blocks(css=custom_css) as demo:
181
  width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=512)
182
  height = gr.Slider(label="Height", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=512)
183
  guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=15, step=0.1, value=3.5)
184
- num_inference_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=50, step=1, value=20)
185
 
186
- generate_btn = gr.Button("Generate Image + Prompt Enhanced", elem_classes="submit-btn")
187
 
188
  with gr.Column(scale=1):
189
  with gr.Group(elem_classes="output-group"):
190
- output_image = gr.Image(label="Result", elem_id="gallery", show_label=False)
191
- final_prompt = gr.Textbox(label="Final Prompt Used")
192
- used_seed = gr.Number(label="Seed Used")
193
 
194
  generate_btn.click(
195
  fn=process_workflow,
@@ -200,4 +197,4 @@ with gr.Blocks(css=custom_css) as demo:
200
  outputs=[output_image, final_prompt, used_seed]
201
  )
202
 
203
- demo.launch(debug=True)
 
27
  qwen_processor = AutoProcessor.from_pretrained("prithivMLmods/JSONify-Flux", trust_remote_code=True)
28
 
29
  # Prompt Enhancer
30
+ enhancer_long = pipeline("summarization", model="prithivMLmods/t5-Flan-Prompt-Enhance", device=device)
31
 
32
  MAX_SEED = np.iinfo(np.int32).max
33
  MAX_IMAGE_SIZE = 2048
 
138
  <p><center>
139
  <a href="https://huggingface.co/black-forest-labs/FLUX.1-dev" target="_blank">[FLUX.1-dev Model]</a>
140
  <a href="https://huggingface.co/prithivMLmods/JSONify-Flux" target="_blank">[JSONify Flux Model]</a>
141
+ <a href="https://huggingface.co/prithivMLmods/t5-Flan-Prompt-Enhance" target="_blank">[Prompt Enhancer t5]</a>
142
  <p align="center">Create long prompts from images or enhance your short prompts with prompt enhancer</p>
143
  </center></p>
144
  """
145
 
146
  with gr.Blocks(css=custom_css) as demo:
147
+ gr.HTML(title)
148
 
 
149
  with gr.Sidebar(label="Parameters", open=True):
150
  gr.Markdown(
151
  """
152
  ### About
153
 
154
+ #### Flux.1-Dev
155
+ FLUX.1 [dev] is a 12 billion parameter rectified flow transformer capable of generating images from text descriptions. FLUX.1 [dev] is an open-weight, guidance-distilled model for non-commercial applications. Directly distilled from FLUX.1 [pro], FLUX.1 [dev] obtains similar quality and prompt adherence capabilities, while being more efficient than a standard model of the same size.
156
+ [FLUX.1-dev Model](https://huggingface.co/black-forest-labs/FLUX.1-dev)
 
157
 
158
  #### JSONify-Flux
159
+ JSONify-Flux is a multimodal image-text-text model trained on a dataset of FLUX-generated images with context-rich captions based on the Qwen2VL architecture. The JSON-based instruction has been manually removed to avoid JSON format captions.
160
+ [JSONify-Flux Model](https://huggingface.co/prithivMLmods/JSONify-Flux)
161
 
162
  #### t5-Flan-Prompt-Enhance
163
+ t5-Flan-Prompt-Enhance is a prompt summarization model that enriches synthetic FLUX prompts with more detailed descriptions.
164
+ [t5-Flan-Prompt-Enhance Model](https://huggingface.co/prithivMLmods/t5-Flan-Prompt-Enhance)
165
  """
166
  )
167
 
 
 
168
  with gr.Row():
169
  with gr.Column(scale=1):
170
  with gr.Group(elem_classes="input-group"):
 
178
  width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=512)
179
  height = gr.Slider(label="Height", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=512)
180
  guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=15, step=0.1, value=3.5)
181
+ num_inference_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=50, step=1, value=32)
182
 
183
+ generate_btn = gr.Button("Generate Image & Prompt", elem_classes="submit-btn")
184
 
185
  with gr.Column(scale=1):
186
  with gr.Group(elem_classes="output-group"):
187
+ output_image = gr.Image(label="result", elem_id="gallery", show_label=False)
188
+ final_prompt = gr.Textbox(label="prompt")
189
+ used_seed = gr.Number(label="seed")
190
 
191
  generate_btn.click(
192
  fn=process_workflow,
 
197
  outputs=[output_image, final_prompt, used_seed]
198
  )
199
 
200
+ demo.launch(debug=True)