ovi054 commited on
Commit
bf0e257
·
verified ·
1 Parent(s): 7c99485

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -112
app.py CHANGED
@@ -61,7 +61,7 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidan
61
  good_vae=good_vae, # Assuming good_vae is defined elsewhere
62
  joint_attention_kwargs=joint_attention_kwargs, # Fixed parameter name
63
  ):
64
- yield img, seed, seed
65
  finally:
66
  # Unload LoRA weights if they were loaded
67
  if lora_id:
@@ -72,114 +72,6 @@ examples = [
72
  "a cat holding a sign that says hello world",
73
  "an anime illustration of a wiener schnitzel",
74
  ]
75
-
76
- # css="""
77
- # #col-container {
78
- # margin: 0 auto;
79
- # max-width: 520px;
80
- # }
81
- # """
82
-
83
- # with gr.Blocks(css=css) as demo:
84
-
85
- # with gr.Column(elem_id="col-container"):
86
- # gr.Markdown(f"""# FLUX.1 [dev] LoRA
87
- # 12B param rectified flow transformer guidance-distilled from [FLUX.1 [pro]](https://blackforestlabs.ai/)
88
- # [[non-commercial license](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md)] [[blog](https://blackforestlabs.ai/announcing-black-forest-labs/)] [[model](https://huggingface.co/black-forest-labs/FLUX.1-dev)]
89
- # """)
90
-
91
- # with gr.Row():
92
-
93
- # prompt = gr.Text(
94
- # label="Prompt",
95
- # show_label=False,
96
- # max_lines=1,
97
- # placeholder="Enter your prompt",
98
- # container=False,
99
- # )
100
-
101
- # run_button = gr.Button("Run", scale=0)
102
-
103
- # result = gr.Image(label="Result", show_label=False)
104
-
105
- # with gr.Accordion("Advanced Settings", open=False):
106
-
107
- # seed = gr.Slider(
108
- # label="Seed",
109
- # minimum=0,
110
- # maximum=MAX_SEED,
111
- # step=1,
112
- # value=0,
113
- # )
114
-
115
- # randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
116
-
117
- # with gr.Row():
118
-
119
- # width = gr.Slider(
120
- # label="Width",
121
- # minimum=256,
122
- # maximum=MAX_IMAGE_SIZE,
123
- # step=8,
124
- # value=1024,
125
- # )
126
-
127
- # height = gr.Slider(
128
- # label="Height",
129
- # minimum=256,
130
- # maximum=MAX_IMAGE_SIZE,
131
- # step=8,
132
- # value=1024,
133
- # )
134
-
135
- # with gr.Row():
136
-
137
- # guidance_scale = gr.Slider(
138
- # label="Guidance Scale",
139
- # minimum=1,
140
- # maximum=15,
141
- # step=0.1,
142
- # value=3.5,
143
- # )
144
-
145
- # num_inference_steps = gr.Slider(
146
- # label="Number of inference steps",
147
- # minimum=1,
148
- # maximum=50,
149
- # step=1,
150
- # value=28,
151
- # )
152
-
153
- # with gr.Row():
154
- # lora_id = gr.Textbox(
155
- # label="LoRA Model ID (HuggingFace path)",
156
- # placeholder="username/lora-model",
157
- # max_lines=1
158
- # )
159
- # lora_scale = gr.Slider(
160
- # label="LoRA Scale",
161
- # minimum=0,
162
- # maximum=2,
163
- # step=0.01,
164
- # value=0.95,
165
- # )
166
-
167
- # gr.Examples(
168
- # examples = examples,
169
- # fn = infer,
170
- # inputs = [prompt],
171
- # outputs = [result, seed],
172
- # cache_examples="lazy"
173
- # )
174
-
175
- # gr.on(
176
- # triggers=[run_button.click, prompt.submit],
177
- # fn = infer,
178
- # inputs = [prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps,lora_id,lora_scale],
179
- # outputs = [result, seed]
180
- # )
181
-
182
- # demo.launch()
183
 
184
  css = """
185
  #col-container {
@@ -231,8 +123,6 @@ with gr.Blocks(css=css) as app:
231
  with gr.Column():
232
  with gr.Row():
233
  image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
234
- with gr.Row():
235
- seed_output = gr.Textbox(label="Seed Used", show_copy_button = True)
236
 
237
  # gr.Markdown(article_text)
238
  with gr.Column():
@@ -244,7 +134,7 @@ with gr.Blocks(css=css) as app:
244
  triggers=[text_button.click, text_prompt.submit],
245
  fn = infer,
246
  inputs=[text_prompt, seed, randomize_seed, width, height, cfg, steps, custom_lora, lora_scale],
247
- outputs=[image_output,seed_output, seed]
248
  )
249
 
250
  # text_button.click(query, inputs=[custom_lora, text_prompt, steps, cfg, randomize_seed, seed, width, height], outputs=[image_output,seed_output, seed])
 
61
  good_vae=good_vae, # Assuming good_vae is defined elsewhere
62
  joint_attention_kwargs=joint_attention_kwargs, # Fixed parameter name
63
  ):
64
+ yield img, seed
65
  finally:
66
  # Unload LoRA weights if they were loaded
67
  if lora_id:
 
72
  "a cat holding a sign that says hello world",
73
  "an anime illustration of a wiener schnitzel",
74
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  css = """
77
  #col-container {
 
123
  with gr.Column():
124
  with gr.Row():
125
  image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
 
 
126
 
127
  # gr.Markdown(article_text)
128
  with gr.Column():
 
134
  triggers=[text_button.click, text_prompt.submit],
135
  fn = infer,
136
  inputs=[text_prompt, seed, randomize_seed, width, height, cfg, steps, custom_lora, lora_scale],
137
+ outputs=[image_output, seed]
138
  )
139
 
140
  # text_button.click(query, inputs=[custom_lora, text_prompt, steps, cfg, randomize_seed, seed, width, height], outputs=[image_output,seed_output, seed])