Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ article_text = """
|
|
27 |
</div>
|
28 |
"""
|
29 |
|
30 |
-
def query(lora_id, prompt, is_negative=False, steps=28, cfg_scale=3.5, sampler="DPM++ 2M Karras", seed=-1,
|
31 |
if prompt == "" or prompt == None:
|
32 |
return None
|
33 |
|
@@ -56,6 +56,10 @@ def query(lora_id, prompt, is_negative=False, steps=28, cfg_scale=3.5, sampler="
|
|
56 |
"steps": steps,
|
57 |
"cfg_scale": cfg_scale,
|
58 |
"seed": seed,
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
|
@@ -101,11 +105,12 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', css=css) as app:
|
|
101 |
custom_lora = gr.Textbox(label="Custom LoRA", info="LoRA Hugging Face path (optional)", placeholder="multimodalart/vintage-ads-flux")
|
102 |
with gr.Row():
|
103 |
with gr.Accordion("Advanced Settings", open=False):
|
104 |
-
|
|
|
|
|
105 |
steps = gr.Slider(label="Sampling steps", value=28, minimum=1, maximum=100, step=1)
|
106 |
cfg = gr.Slider(label="CFG Scale", value=3.5, minimum=1, maximum=20, step=0.5)
|
107 |
method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
|
108 |
-
strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
|
109 |
seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
|
110 |
|
111 |
with gr.Row():
|
@@ -123,6 +128,6 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', css=css) as app:
|
|
123 |
)
|
124 |
|
125 |
|
126 |
-
text_button.click(query, inputs=[custom_lora, text_prompt, negative_prompt, steps, cfg, method, seed,
|
127 |
|
128 |
app.launch(show_api=False, share=False)
|
|
|
27 |
</div>
|
28 |
"""
|
29 |
|
30 |
+
def query(lora_id, prompt, is_negative=False, steps=28, cfg_scale=3.5, sampler="DPM++ 2M Karras", seed=-1, width=1024, height=1024):
|
31 |
if prompt == "" or prompt == None:
|
32 |
return None
|
33 |
|
|
|
56 |
"steps": steps,
|
57 |
"cfg_scale": cfg_scale,
|
58 |
"seed": seed,
|
59 |
+
"parameters": {
|
60 |
+
"width": width, # Pass the width to the API
|
61 |
+
"height": height # Pass the height to the API
|
62 |
+
}
|
63 |
}
|
64 |
|
65 |
response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
|
|
|
105 |
custom_lora = gr.Textbox(label="Custom LoRA", info="LoRA Hugging Face path (optional)", placeholder="multimodalart/vintage-ads-flux")
|
106 |
with gr.Row():
|
107 |
with gr.Accordion("Advanced Settings", open=False):
|
108 |
+
with gr.Row():
|
109 |
+
width = gr.Slider(label="Width", value=1024, minimum=64, maximum=1216, step=8)
|
110 |
+
height = gr.Slider(label="Height", value=1024, minimum=64, maximum=1216, step=8)
|
111 |
steps = gr.Slider(label="Sampling steps", value=28, minimum=1, maximum=100, step=1)
|
112 |
cfg = gr.Slider(label="CFG Scale", value=3.5, minimum=1, maximum=20, step=0.5)
|
113 |
method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
|
|
|
114 |
seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
|
115 |
|
116 |
with gr.Row():
|
|
|
128 |
)
|
129 |
|
130 |
|
131 |
+
text_button.click(query, inputs=[custom_lora, text_prompt, negative_prompt, steps, cfg, method, seed, width, height], outputs=[image_output,seed_output])
|
132 |
|
133 |
app.launch(show_api=False, share=False)
|