Spaces:
Build error
Build error
styling
Browse files
app.py
CHANGED
@@ -1,9 +1,9 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image
|
3 |
import os
|
4 |
from src.flux.xflux_pipeline import XFluxPipeline
|
5 |
import random
|
6 |
-
import spaces
|
7 |
|
8 |
def run_xflux_pipeline(
|
9 |
prompt, image, repo_id, name, device,
|
@@ -124,53 +124,82 @@ def process_image(image, prompt, steps, use_lora, use_controlnet, use_depth, use
|
|
124 |
|
125 |
|
126 |
custom_css = """
|
127 |
-
body {
|
128 |
-
background: rgb(24, 24, 27);
|
129 |
-
}
|
130 |
-
|
131 |
.gradio-container {
|
132 |
-
|
|
|
|
|
133 |
}
|
134 |
-
|
135 |
-
|
136 |
-
background: rgb(24, 24, 27);
|
137 |
}
|
138 |
|
139 |
-
|
|
|
140 |
background: rgb(24, 24, 27);
|
|
|
141 |
}
|
142 |
|
143 |
-
|
144 |
.sidebar {
|
|
|
|
|
145 |
background: rgb(31, 31, 35);
|
146 |
border-right: 1px solid rgb(41, 41, 41);
|
147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
"""
|
149 |
|
150 |
with gr.Blocks(css=custom_css) as demo:
|
151 |
with gr.Row(elem_classes="app-container"):
|
152 |
-
with gr.Column():
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
with gr.Column():
|
174 |
output = gr.Gallery(label="Galery output", elem_classes="galery", selected_index=0)
|
175 |
|
176 |
submit_btn.click(process_image, inputs=[input_image, prompt, steps, use_lora, controlnet, use_depth, use_hed, use_ip, lora_name, lora_path, lora_weight, negative_image, neg_prompt, true_gs, guidance, cfg], outputs=output)
|
|
|
1 |
+
import spaces
|
2 |
import gradio as gr
|
3 |
from PIL import Image
|
4 |
import os
|
5 |
from src.flux.xflux_pipeline import XFluxPipeline
|
6 |
import random
|
|
|
7 |
|
8 |
def run_xflux_pipeline(
|
9 |
prompt, image, repo_id, name, device,
|
|
|
124 |
|
125 |
|
126 |
custom_css = """
|
|
|
|
|
|
|
|
|
127 |
.gradio-container {
|
128 |
+
margin: unset !important;
|
129 |
+
padding: unset !important;
|
130 |
+
max-width: unset !important;
|
131 |
}
|
132 |
+
.gradio-app {
|
133 |
+
min-height: unset !important;
|
|
|
134 |
}
|
135 |
|
136 |
+
.app-container {
|
137 |
+
height: 100vh;
|
138 |
background: rgb(24, 24, 27);
|
139 |
+
gap: unset;
|
140 |
}
|
141 |
|
|
|
142 |
.sidebar {
|
143 |
+
max-width: 300px;
|
144 |
+
padding: 1rem;
|
145 |
background: rgb(31, 31, 35);
|
146 |
border-right: 1px solid rgb(41, 41, 41);
|
147 |
}
|
148 |
+
|
149 |
+
.galery {
|
150 |
+
height: 100%;
|
151 |
+
}
|
152 |
+
|
153 |
+
.gallery-container {
|
154 |
+
height: 100%;
|
155 |
+
}
|
156 |
+
|
157 |
+
.grid-container {
|
158 |
+
height: 97vh !important;
|
159 |
+
}
|
160 |
+
|
161 |
+
.grid-wrap {
|
162 |
+
max-height: unset;
|
163 |
+
overflow-y: unset;
|
164 |
+
}
|
165 |
+
|
166 |
+
.thumbnail-item img {
|
167 |
+
object-fit: contain;
|
168 |
+
}
|
169 |
+
|
170 |
+
.side_items {
|
171 |
+
height: 96vh;
|
172 |
+
}
|
173 |
+
|
174 |
+
.form {
|
175 |
+
flex-wrap: unset;
|
176 |
+
height: 100%;
|
177 |
+
}
|
178 |
"""
|
179 |
|
180 |
with gr.Blocks(css=custom_css) as demo:
|
181 |
with gr.Row(elem_classes="app-container"):
|
182 |
+
with gr.Column(scale=1, min_width=300, elem_classes="sidebar"):
|
183 |
+
with gr.Column(elem_classes="side_items"):
|
184 |
+
input_image = gr.Image(label="Image", type="filepath")
|
185 |
+
negative_image = gr.Image(label="Negative_image", type="filepath")
|
186 |
+
submit_btn = gr.Button("Submit")
|
187 |
+
prompt = gr.Textbox(label="Prompt")
|
188 |
+
neg_prompt = gr.Textbox(label="Neg Prompt")
|
189 |
+
steps = gr.Slider(step=1, minimum=1, maximum=64, value=28, label="Num Steps")
|
190 |
+
use_lora = gr.Checkbox(label="Use LORA", value=True)
|
191 |
+
lora_path = gr.Textbox(label="LoraPath", value="XLabs-AI/flux-lora-collection")
|
192 |
+
lora_name = gr.Textbox(label="LoraName", value="realism_lora.safetensors")
|
193 |
+
lora_weight = gr.Slider(step=0.1, minimum=0, maximum=1, value=0.7, label="Lora Weight")
|
194 |
+
controlnet = gr.Checkbox(label="Use Controlnet(by default uses canny)", value=True)
|
195 |
+
use_ip = gr.Checkbox(label="Use IP")
|
196 |
+
use_depth = gr.Checkbox(label="Use depth")
|
197 |
+
use_hed = gr.Checkbox(label="Use hed")
|
198 |
+
true_gs = gr.Slider(step=0.1, minimum=0, maximum=10, value=3.5, label="TrueGs")
|
199 |
+
guidance = gr.Slider(minimum=1, maximum=10, value=4, label="Guidance")
|
200 |
+
cfg = gr.Slider(minimum=1, maximum=10, value=1, label="CFG")
|
201 |
+
|
202 |
+
with gr.Column(scale=2, elem_classes="app"):
|
|
|
203 |
output = gr.Gallery(label="Galery output", elem_classes="galery", selected_index=0)
|
204 |
|
205 |
submit_btn.click(process_image, inputs=[input_image, prompt, steps, use_lora, controlnet, use_depth, use_hed, use_ip, lora_name, lora_path, lora_weight, negative_image, neg_prompt, true_gs, guidance, cfg], outputs=output)
|