Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,9 +20,10 @@ print("downloading models - 4/4")
|
|
| 20 |
hf_hub_download("XLabs-AI/flux-controlnet-canny", "controlnet.safetensors")
|
| 21 |
print("downloaded!")
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
def process_image(lora_path, lora_name, number_of_images, image, prompt, steps, use_lora, use_controlnet, use_depth, use_hed, use_ip, lora_weight, negative_image, neg_prompt, true_gs, guidance, cfg):
|
| 25 |
-
from src.flux.xflux_pipeline import XFluxPipeline
|
| 26 |
def run_xflux_pipeline(
|
| 27 |
prompt, image, repo_id, name, device,
|
| 28 |
model_type, width, height, timestep_to_start_cfg, num_steps, true_gs, guidance,
|
|
@@ -139,58 +140,7 @@ def process_image(lora_path, lora_name, number_of_images, image, prompt, steps,
|
|
| 139 |
)
|
| 140 |
|
| 141 |
|
| 142 |
-
|
| 143 |
-
body {
|
| 144 |
-
overflow-y: hidden;
|
| 145 |
-
}
|
| 146 |
-
.gradio-container {
|
| 147 |
-
margin: unset !important;
|
| 148 |
-
padding: unset !important;
|
| 149 |
-
max-width: unset !important;
|
| 150 |
-
}
|
| 151 |
-
.gradio-app {
|
| 152 |
-
min-height: unset !important;
|
| 153 |
-
}
|
| 154 |
-
|
| 155 |
-
.app {
|
| 156 |
-
height: 100%;
|
| 157 |
-
}
|
| 158 |
-
|
| 159 |
-
.app-container {
|
| 160 |
-
height: 100vh;
|
| 161 |
-
background: rgb(24, 24, 27);
|
| 162 |
-
gap: unset;
|
| 163 |
-
}
|
| 164 |
-
|
| 165 |
-
.sidebar {
|
| 166 |
-
overflow-y: auto;
|
| 167 |
-
height: 100%;
|
| 168 |
-
max-width: 500px;
|
| 169 |
-
padding: 1rem;
|
| 170 |
-
background: rgb(31, 31, 35);
|
| 171 |
-
border-right: 1px solid rgb(41, 41, 41);
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
.grid-wrap {
|
| 175 |
-
max-height: unset;
|
| 176 |
-
overflow-y: unset;
|
| 177 |
-
}
|
| 178 |
-
|
| 179 |
-
.thumbnail-item img {
|
| 180 |
-
object-fit: contain;
|
| 181 |
-
}
|
| 182 |
-
|
| 183 |
-
.side_items {
|
| 184 |
-
height: auto;
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
.form {
|
| 188 |
-
flex-wrap: unset;
|
| 189 |
-
height: auto;
|
| 190 |
-
}
|
| 191 |
-
"""
|
| 192 |
-
|
| 193 |
-
with gr.Blocks(css=custom_css) as demo:
|
| 194 |
with gr.Row(elem_classes="app-container"):
|
| 195 |
with gr.Column(scale=1, min_width=500, elem_classes="sidebar"):
|
| 196 |
with gr.Column(elem_classes="side_items"):
|
|
@@ -208,7 +158,6 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 208 |
lora_name = gr.Textbox(label="Lora Name", value="realism_lora.safetensors")
|
| 209 |
lora_weight = gr.Slider(step=0.1, minimum=0, maximum=1, value=0.7, label="Lora Weight")
|
| 210 |
|
| 211 |
-
number_of_images = gr.Slider(step=1, minimum=0, maximum=4, value=2, label="Number of Images")
|
| 212 |
true_gs = gr.Slider(step=0.1, minimum=0, maximum=10, value=3.5, label="TrueGs")
|
| 213 |
guidance = gr.Slider(minimum=1, maximum=10, value=4, label="Guidance")
|
| 214 |
cfg = gr.Slider(minimum=1, maximum=10, value=1, label="CFG")
|
|
@@ -219,7 +168,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 219 |
with gr.Column(scale=2, elem_classes="app"):
|
| 220 |
output = gr.Gallery(label="Galery output", elem_classes="galery")
|
| 221 |
|
| 222 |
-
submit_btn.click(process_image, inputs=[lora_path, lora_name,
|
| 223 |
|
| 224 |
if __name__ == '__main__':
|
| 225 |
demo.launch(share=True, debug=True)
|
|
|
|
| 20 |
hf_hub_download("XLabs-AI/flux-controlnet-canny", "controlnet.safetensors")
|
| 21 |
print("downloaded!")
|
| 22 |
|
| 23 |
+
from src.flux.xflux_pipeline import XFluxPipeline
|
| 24 |
+
|
| 25 |
+
@spaces.GPU(duration=200)
|
| 26 |
def process_image(lora_path, lora_name, number_of_images, image, prompt, steps, use_lora, use_controlnet, use_depth, use_hed, use_ip, lora_weight, negative_image, neg_prompt, true_gs, guidance, cfg):
|
|
|
|
| 27 |
def run_xflux_pipeline(
|
| 28 |
prompt, image, repo_id, name, device,
|
| 29 |
model_type, width, height, timestep_to_start_cfg, num_steps, true_gs, guidance,
|
|
|
|
| 140 |
)
|
| 141 |
|
| 142 |
|
| 143 |
+
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
with gr.Row(elem_classes="app-container"):
|
| 145 |
with gr.Column(scale=1, min_width=500, elem_classes="sidebar"):
|
| 146 |
with gr.Column(elem_classes="side_items"):
|
|
|
|
| 158 |
lora_name = gr.Textbox(label="Lora Name", value="realism_lora.safetensors")
|
| 159 |
lora_weight = gr.Slider(step=0.1, minimum=0, maximum=1, value=0.7, label="Lora Weight")
|
| 160 |
|
|
|
|
| 161 |
true_gs = gr.Slider(step=0.1, minimum=0, maximum=10, value=3.5, label="TrueGs")
|
| 162 |
guidance = gr.Slider(minimum=1, maximum=10, value=4, label="Guidance")
|
| 163 |
cfg = gr.Slider(minimum=1, maximum=10, value=1, label="CFG")
|
|
|
|
| 168 |
with gr.Column(scale=2, elem_classes="app"):
|
| 169 |
output = gr.Gallery(label="Galery output", elem_classes="galery")
|
| 170 |
|
| 171 |
+
submit_btn.click(process_image, inputs=[lora_path, lora_name, 1, input_image, prompt, steps, use_lora, controlnet, use_depth, use_hed, use_ip, lora_weight, negative_image, neg_prompt, true_gs, guidance, cfg], outputs=output)
|
| 172 |
|
| 173 |
if __name__ == '__main__':
|
| 174 |
demo.launch(share=True, debug=True)
|