Spaces:
Running
on
Zero
Running
on
Zero
AlekseyCalvin
commited on
Commit
•
a2c96ec
1
Parent(s):
f1b6649
Update app.py
Browse files
app.py
CHANGED
@@ -97,9 +97,10 @@ class calculateDuration:
|
|
97 |
|
98 |
def update_selection(evt: gr.SelectData, width, height):
|
99 |
selected_lora = loras[evt.index]
|
100 |
-
new_placeholder = f"
|
101 |
lora_repo = selected_lora["repo"]
|
102 |
-
|
|
|
103 |
if "aspect" in selected_lora:
|
104 |
if selected_lora["aspect"] == "portrait":
|
105 |
width = 768
|
@@ -139,10 +140,10 @@ def run_lora(prompt, cfg_scale, steps, selected_index, randomize_seed, seed, wid
|
|
139 |
|
140 |
selected_lora = loras[selected_index]
|
141 |
lora_path = selected_lora["repo"]
|
142 |
-
trigger_word = selected_lora[
|
143 |
if(trigger_word):
|
144 |
-
if
|
145 |
-
if selected_lora[
|
146 |
prompt_mash = f"{trigger_word} {prompt}"
|
147 |
else:
|
148 |
prompt_mash = f"{prompt} {trigger_word}"
|
@@ -184,17 +185,17 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
|
184 |
)
|
185 |
# Info blob stating what the app is running
|
186 |
info_blob = gr.HTML(
|
187 |
-
"""<div id="info_blob"> Activist & Futurealist Fast FLUX De-Distilled LoRA Gallery (Running on the the FLUX De-Distilled Mix Tuned V1 by wikeeyang)</div>"""
|
188 |
)
|
189 |
|
190 |
# Info blob stating what the app is running
|
191 |
info_blob = gr.HTML(
|
192 |
-
"""<div id="info_blob">
|
193 |
)
|
194 |
selected_index = gr.State(None)
|
195 |
with gr.Row():
|
196 |
with gr.Column(scale=3):
|
197 |
-
prompt = gr.Textbox(label="Prompt", lines=
|
198 |
with gr.Column(scale=1, elem_id="gen_column"):
|
199 |
generate_button = gr.Button("Generate", variant="primary", elem_id="gen_btn")
|
200 |
with gr.Row():
|
@@ -215,12 +216,12 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as app:
|
|
215 |
with gr.Accordion("Advanced Settings", open=True):
|
216 |
with gr.Column():
|
217 |
with gr.Row():
|
218 |
-
cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, step=0.5, value=
|
219 |
-
steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=
|
220 |
|
221 |
with gr.Row():
|
222 |
-
width = gr.Slider(label="Width", minimum=256, maximum=
|
223 |
-
height = gr.Slider(label="Height", minimum=256, maximum=
|
224 |
|
225 |
with gr.Row():
|
226 |
randomize_seed = gr.Checkbox(True, label="Randomize seed")
|
|
|
97 |
|
98 |
def update_selection(evt: gr.SelectData, width, height):
|
99 |
selected_lora = loras[evt.index]
|
100 |
+
new_placeholder = f"Prompt with activator word(s): '{selected_lora['trigger_word']}'! "
|
101 |
lora_repo = selected_lora["repo"]
|
102 |
+
lora_trigger = selected_lora['trigger_word']
|
103 |
+
updated_text = f"### Selected: [{lora_repo}](https://huggingface.co/{lora_repo}). Prompt using: '{lora_trigger}'!"
|
104 |
if "aspect" in selected_lora:
|
105 |
if selected_lora["aspect"] == "portrait":
|
106 |
width = 768
|
|
|
140 |
|
141 |
selected_lora = loras[selected_index]
|
142 |
lora_path = selected_lora["repo"]
|
143 |
+
trigger_word = selected_lora['trigger_word']
|
144 |
if(trigger_word):
|
145 |
+
if 'trigger_position' in selected_lora:
|
146 |
+
if selected_lora['trigger_position'] == "prepend":
|
147 |
prompt_mash = f"{trigger_word} {prompt}"
|
148 |
else:
|
149 |
prompt_mash = f"{prompt} {trigger_word}"
|
|
|
185 |
)
|
186 |
# Info blob stating what the app is running
|
187 |
info_blob = gr.HTML(
|
188 |
+
"""<div id="info_blob"> Activist & Futurealist Fast FLUX De-Distilled LoRA Gallery (Running on the the FLUX De-Distilled Mix Tuned V1 by wikeeyang). Nearly all of the LoRA adapters accessible via this space were trained by us in an extensive progression of inspired experiments and conceptual mini-projects. Check out our poetry translations at WWW.SILVERagePOETS.com Find our music on SoundCloud @ AlekseyCalvin & YouTube @ SilverAgePoets / AlekseyCalvin! </div>"""
|
189 |
)
|
190 |
|
191 |
# Info blob stating what the app is running
|
192 |
info_blob = gr.HTML(
|
193 |
+
"""<div id="info_blob"> To reinforce/focus in selected fine-tuned LoRAs (Low-Rank Adapters), add special “trigger" words/phrases to your prompts. </div>"""
|
194 |
)
|
195 |
selected_index = gr.State(None)
|
196 |
with gr.Row():
|
197 |
with gr.Column(scale=3):
|
198 |
+
prompt = gr.Textbox(label="Prompt", lines=2, placeholder="Select LoRA & add prompt (+optional activator phrase)!")
|
199 |
with gr.Column(scale=1, elem_id="gen_column"):
|
200 |
generate_button = gr.Button("Generate", variant="primary", elem_id="gen_btn")
|
201 |
with gr.Row():
|
|
|
216 |
with gr.Accordion("Advanced Settings", open=True):
|
217 |
with gr.Column():
|
218 |
with gr.Row():
|
219 |
+
cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, step=0.5, value=2.0)
|
220 |
+
steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=8)
|
221 |
|
222 |
with gr.Row():
|
223 |
+
width = gr.Slider(label="Width", minimum=256, maximum=2048, step=64, value=1024)
|
224 |
+
height = gr.Slider(label="Height", minimum=256, maximum=2048, step=64, value=1024)
|
225 |
|
226 |
with gr.Row():
|
227 |
randomize_seed = gr.Checkbox(True, label="Randomize seed")
|