Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,9 +76,10 @@ button {
|
|
| 76 |
background-color: #f5f5f5; /* Fondo gris claro */
|
| 77 |
color: #333333; /* Texto gris oscuro */
|
| 78 |
border: 1px solid black; /* Borde negro en botones */
|
| 79 |
-
width:
|
| 80 |
box-sizing: border-box; /* Incluir el borde en el ancho total */
|
| 81 |
padding: 10px; /* Espacio interno en el bot贸n */
|
|
|
|
| 82 |
}
|
| 83 |
|
| 84 |
button.primary {
|
|
@@ -103,24 +104,46 @@ h1, h2, h3, h4, h5, h6 {
|
|
| 103 |
.button-container {
|
| 104 |
display: flex;
|
| 105 |
flex-direction: column;
|
| 106 |
-
align-items: center; /* Centra
|
| 107 |
}
|
| 108 |
|
| 109 |
.button-container button {
|
| 110 |
width: auto; /* Ajusta el ancho del bot贸n para m贸viles */
|
| 111 |
-
margin-top: 10px; /* Espacio superior para
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
}
|
| 113 |
}
|
| 114 |
|
| 115 |
@media (min-width: 769px) {
|
| 116 |
.button-container {
|
| 117 |
display: flex;
|
| 118 |
-
justify-content: flex-end; /* Alinea
|
| 119 |
}
|
| 120 |
|
| 121 |
.button-container button {
|
| 122 |
width: auto; /* Ajusta el ancho del bot贸n para escritorio */
|
| 123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
}
|
| 125 |
"""
|
| 126 |
|
|
@@ -140,7 +163,12 @@ with gr.Blocks(css=css) as app:
|
|
| 140 |
|
| 141 |
with gr.Row():
|
| 142 |
with gr.Column(scale=1):
|
| 143 |
-
text_prompt = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
|
| 145 |
with gr.Accordion("Opciones Avanzadas", open=False):
|
| 146 |
negative_prompt = gr.Textbox(
|
|
@@ -167,7 +195,11 @@ with gr.Blocks(css=css) as app:
|
|
| 167 |
method = gr.Radio(
|
| 168 |
label="Estilo de sue帽o (M茅todo de muestreo)",
|
| 169 |
value="DPM++ 2M Karras",
|
| 170 |
-
choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
)
|
| 172 |
strength = gr.Slider(
|
| 173 |
label="Intensidad del sue帽o (Fuerza de transformaci贸n)",
|
|
@@ -177,15 +209,16 @@ with gr.Blocks(css=css) as app:
|
|
| 177 |
step=0.001
|
| 178 |
)
|
| 179 |
|
| 180 |
-
# Mover el componente de ejemplos aqu铆, justo debajo de Opciones Avanzadas
|
| 181 |
gr.Examples(examples=examples, inputs=text_prompt)
|
| 182 |
|
| 183 |
with gr.Row(elem_id="button-container"):
|
| 184 |
generate_button = gr.Button("QUIERO VER MI SUE脩O", elem_id="generate-button", variant="primary")
|
|
|
|
| 185 |
|
| 186 |
with gr.Column(scale=1):
|
| 187 |
image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
|
| 188 |
|
| 189 |
generate_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, strength], outputs=image_output)
|
|
|
|
| 190 |
|
| 191 |
app.launch(show_api=False, share=False)
|
|
|
|
| 76 |
background-color: #f5f5f5; /* Fondo gris claro */
|
| 77 |
color: #333333; /* Texto gris oscuro */
|
| 78 |
border: 1px solid black; /* Borde negro en botones */
|
| 79 |
+
width: auto; /* Ancho autom谩tico para botones */
|
| 80 |
box-sizing: border-box; /* Incluir el borde en el ancho total */
|
| 81 |
padding: 10px; /* Espacio interno en el bot贸n */
|
| 82 |
+
margin-right: 10px; /* Espacio entre los botones */
|
| 83 |
}
|
| 84 |
|
| 85 |
button.primary {
|
|
|
|
| 104 |
.button-container {
|
| 105 |
display: flex;
|
| 106 |
flex-direction: column;
|
| 107 |
+
align-items: center; /* Centra los botones en vista m贸vil */
|
| 108 |
}
|
| 109 |
|
| 110 |
.button-container button {
|
| 111 |
width: auto; /* Ajusta el ancho del bot贸n para m贸viles */
|
| 112 |
+
margin-top: 10px; /* Espacio superior para los botones en m贸viles */
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
.radio-group {
|
| 116 |
+
display: flex;
|
| 117 |
+
flex-direction: column; /* Ajusta los botones de radio en una columna */
|
| 118 |
+
align-items: flex-start; /* Alinea los botones a la izquierda */
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.radio-group label {
|
| 122 |
+
margin-bottom: 10px; /* Espacio entre los botones de radio */
|
| 123 |
+
font-size: 16px; /* Tama帽o de fuente m谩s grande para m贸viles */
|
| 124 |
}
|
| 125 |
}
|
| 126 |
|
| 127 |
@media (min-width: 769px) {
|
| 128 |
.button-container {
|
| 129 |
display: flex;
|
| 130 |
+
justify-content: flex-end; /* Alinea los botones a la derecha en vista de escritorio */
|
| 131 |
}
|
| 132 |
|
| 133 |
.button-container button {
|
| 134 |
width: auto; /* Ajusta el ancho del bot贸n para escritorio */
|
| 135 |
}
|
| 136 |
+
|
| 137 |
+
.radio-group {
|
| 138 |
+
display: flex;
|
| 139 |
+
flex-direction: row; /* Ajusta los botones de radio en una fila */
|
| 140 |
+
justify-content: space-between; /* Espacio entre los botones de radio */
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.radio-group label {
|
| 144 |
+
margin-right: 20px; /* Espacio entre los botones de radio */
|
| 145 |
+
font-size: 18px; /* Tama帽o de fuente para escritorio */
|
| 146 |
+
}
|
| 147 |
}
|
| 148 |
"""
|
| 149 |
|
|
|
|
| 163 |
|
| 164 |
with gr.Row():
|
| 165 |
with gr.Column(scale=1):
|
| 166 |
+
text_prompt = gr.Textbox(
|
| 167 |
+
label="驴Cu谩l fue tu sue帽o?",
|
| 168 |
+
placeholder="Describe lo que so帽aste, no omitas ning煤n detalle.",
|
| 169 |
+
lines=2,
|
| 170 |
+
elem_id="prompt-text-input"
|
| 171 |
+
)
|
| 172 |
|
| 173 |
with gr.Accordion("Opciones Avanzadas", open=False):
|
| 174 |
negative_prompt = gr.Textbox(
|
|
|
|
| 195 |
method = gr.Radio(
|
| 196 |
label="Estilo de sue帽o (M茅todo de muestreo)",
|
| 197 |
value="DPM++ 2M Karras",
|
| 198 |
+
choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"],
|
| 199 |
+
elem_id="sampling-method-radio",
|
| 200 |
+
type="value",
|
| 201 |
+
container_elem_id="sampling-method-container",
|
| 202 |
+
elem_id="sampling-method-input"
|
| 203 |
)
|
| 204 |
strength = gr.Slider(
|
| 205 |
label="Intensidad del sue帽o (Fuerza de transformaci贸n)",
|
|
|
|
| 209 |
step=0.001
|
| 210 |
)
|
| 211 |
|
|
|
|
| 212 |
gr.Examples(examples=examples, inputs=text_prompt)
|
| 213 |
|
| 214 |
with gr.Row(elem_id="button-container"):
|
| 215 |
generate_button = gr.Button("QUIERO VER MI SUE脩O", elem_id="generate-button", variant="primary")
|
| 216 |
+
clear_button = gr.Button("Clear", elem_id="clear-button", variant="secondary")
|
| 217 |
|
| 218 |
with gr.Column(scale=1):
|
| 219 |
image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
|
| 220 |
|
| 221 |
generate_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, strength], outputs=image_output)
|
| 222 |
+
clear_button.click(lambda: text_prompt.update(value=""), outputs=text_prompt)
|
| 223 |
|
| 224 |
app.launch(show_api=False, share=False)
|