Spaces:
Sleeping
Sleeping
volví a poner todos los controles
Browse files
app.py
CHANGED
@@ -4,42 +4,137 @@ from gradio_client import Client
|
|
4 |
|
5 |
|
6 |
|
7 |
-
def
|
8 |
-
custom_model
|
9 |
-
weight_name
|
10 |
-
|
11 |
client = Client("fffiloni/sd-xl-custom-model")
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
custom_model=custom_model,
|
16 |
-
api_name="/load_model"
|
17 |
)
|
18 |
|
19 |
-
|
20 |
result = client.predict(
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
)
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
seed = result[1]
|
36 |
|
37 |
-
return image, seed
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
demo.launch()
|
|
|
4 |
|
5 |
|
6 |
|
7 |
+
def infer (prompt, inf_steps, guidance_scale, width, height, seed, lora_weight, progress=gr.Progress(track_tqdm=True)):
|
8 |
+
custom_model="lichorosario/dott_remastered_style_lora_sdxl"
|
9 |
+
weight_name="dott_style.safetensors"
|
10 |
+
|
11 |
client = Client("fffiloni/sd-xl-custom-model")
|
12 |
+
result = client.predict(
|
13 |
+
custom_model=custom_model,
|
14 |
+
api_name="/load_model"
|
|
|
|
|
15 |
)
|
16 |
|
17 |
+
client = Client("fffiloni/sd-xl-custom-model")
|
18 |
result = client.predict(
|
19 |
+
custom_model=custom_model,
|
20 |
+
weight_name=weight_name,
|
21 |
+
prompt="dott style. "+prompt,
|
22 |
+
inf_steps=inf_steps,
|
23 |
+
guidance_scale=guidance_scale,
|
24 |
+
width=width,
|
25 |
+
height=height,
|
26 |
+
seed=-seed,
|
27 |
+
lora_weight=lora_weight,
|
28 |
+
api_name="/infer"
|
29 |
)
|
30 |
|
31 |
+
return result
|
32 |
+
|
|
|
33 |
|
|
|
34 |
|
35 |
+
|
36 |
+
css="""
|
37 |
+
#col-container{
|
38 |
+
margin: 0 auto;
|
39 |
+
max-width: 720px;
|
40 |
+
text-align: left;
|
41 |
+
}
|
42 |
+
div#warning-duplicate {
|
43 |
+
background-color: #ebf5ff;
|
44 |
+
padding: 0 16px 16px;
|
45 |
+
margin: 20px 0;
|
46 |
+
}
|
47 |
+
div#warning-duplicate > .gr-prose > h2, div#warning-duplicate > .gr-prose > p {
|
48 |
+
color: #0f4592!important;
|
49 |
+
}
|
50 |
+
div#warning-duplicate strong {
|
51 |
+
color: #0f4592;
|
52 |
+
}
|
53 |
+
p.actions {
|
54 |
+
display: flex;
|
55 |
+
align-items: center;
|
56 |
+
margin: 20px 0;
|
57 |
+
}
|
58 |
+
div#warning-duplicate .actions a {
|
59 |
+
display: inline-block;
|
60 |
+
margin-right: 10px;
|
61 |
+
}
|
62 |
+
button#load_model_btn{
|
63 |
+
height: 46px;
|
64 |
+
}
|
65 |
+
#status_info{
|
66 |
+
font-size: 0.9em;
|
67 |
+
}
|
68 |
+
.custom-color {
|
69 |
+
color: #030303 !important;
|
70 |
+
}
|
71 |
+
"""
|
72 |
+
|
73 |
+
with gr.Blocks(css=css) as demo:
|
74 |
+
with gr.Column(elem_id="col-container"):
|
75 |
+
prompt_in = gr.Textbox(
|
76 |
+
label="Your Prompt",
|
77 |
+
info = "Dont' forget to include your trigger word if necessary"
|
78 |
+
)
|
79 |
+
with gr.Accordion("Advanced Settings", open=False):
|
80 |
+
with gr.Row():
|
81 |
+
inf_steps = gr.Slider(
|
82 |
+
label="Inference steps",
|
83 |
+
minimum=12,
|
84 |
+
maximum=50,
|
85 |
+
step=1,
|
86 |
+
value=25
|
87 |
+
)
|
88 |
+
guidance_scale = gr.Slider(
|
89 |
+
label="Guidance scale",
|
90 |
+
minimum=0.0,
|
91 |
+
maximum=50.0,
|
92 |
+
step=0.1,
|
93 |
+
value=7.5
|
94 |
+
)
|
95 |
+
with gr.Row():
|
96 |
+
width = gr.Slider(
|
97 |
+
label="Width",
|
98 |
+
minimum=256,
|
99 |
+
maximum=2048,
|
100 |
+
step=32,
|
101 |
+
value=1024,
|
102 |
+
)
|
103 |
+
height = gr.Slider(
|
104 |
+
label="Height",
|
105 |
+
minimum=256,
|
106 |
+
maximum=2048,
|
107 |
+
step=32,
|
108 |
+
value=1024,
|
109 |
+
)
|
110 |
+
|
111 |
+
with gr.Row():
|
112 |
+
seed = gr.Slider(
|
113 |
+
label="Seed",
|
114 |
+
info = "-1 denotes a random seed",
|
115 |
+
minimum=-1,
|
116 |
+
maximum=423538377342,
|
117 |
+
step=1,
|
118 |
+
value=-1
|
119 |
+
)
|
120 |
+
last_used_seed = gr.Number(
|
121 |
+
label = "Last used seed",
|
122 |
+
info = "the seed used in the last generation",
|
123 |
+
)
|
124 |
+
lora_weight = gr.Slider(
|
125 |
+
label="LoRa weigth",
|
126 |
+
minimum=0.0,
|
127 |
+
maximum=1.0,
|
128 |
+
step=0.01,
|
129 |
+
value=1.0
|
130 |
+
)
|
131 |
+
submit_btn = gr.Button("Submit")
|
132 |
+
image_out = gr.Image(label="Image output")
|
133 |
+
|
134 |
+
submit_btn.click(
|
135 |
+
fn = infer,
|
136 |
+
inputs = [prompt_in, inf_steps, guidance_scale, width, height, seed, lora_weight],
|
137 |
+
outputs = [image_out, last_used_seed]
|
138 |
+
)
|
139 |
|
140 |
demo.launch()
|