JeCabrera commited on
Commit
33c51ad
verified
1 Parent(s): 754fa07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -31
app.py CHANGED
@@ -68,30 +68,18 @@ input, textarea, select {
68
  background-color: #f5f5f5; /* Fondo gris claro para inputs */
69
  color: #333333; /* Texto gris oscuro en inputs */
70
  border: 1px solid #cccccc; /* Borde gris claro en inputs */
71
- width: calc(100% - 30px); /* Ancho completo menos el espacio para el bot贸n de borrar */
72
  box-sizing: border-box; /* Incluir el borde en el ancho total */
73
- padding-right: 30px; /* Espacio para el bot贸n de borrar */
74
- }
75
-
76
- .clear-button {
77
- position: absolute;
78
- right: 10px;
79
- top: 50%;
80
- transform: translateY(-50%);
81
- border: none;
82
- background: transparent;
83
- cursor: pointer;
84
- font-size: 16px;
85
- color: #333333;
86
  }
87
 
88
  button {
89
  background-color: #f5f5f5; /* Fondo gris claro */
90
  color: #333333; /* Texto gris oscuro */
91
  border: 1px solid black; /* Borde negro en botones */
92
- width: 100%; /* Ancho completo del bot贸n */
93
  box-sizing: border-box; /* Incluir el borde en el ancho total */
94
  padding: 10px; /* Espacio interno en el bot贸n */
 
95
  }
96
 
97
  button.primary {
@@ -116,19 +104,19 @@ h1, h2, h3, h4, h5, h6 {
116
  .button-container {
117
  display: flex;
118
  flex-direction: column;
119
- align-items: center; /* Centra el bot贸n en vista m贸vil */
120
  }
121
 
122
  .button-container button {
123
  width: auto; /* Ajusta el ancho del bot贸n para m贸viles */
124
- margin-top: 10px; /* Espacio superior para el bot贸n en m贸viles */
125
  }
126
  }
127
 
128
  @media (min-width: 769px) {
129
  .button-container {
130
  display: flex;
131
- justify-content: flex-end; /* Alinea el bot贸n a la derecha en vista de escritorio */
132
  }
133
 
134
  .button-container button {
@@ -143,9 +131,6 @@ examples = [
143
  "((Helmet of Kylo Ren)) in dominant shape of cat, heavily adapted to the physical characteristics of (((cat))), incorporating rugged texture and robust elements. Ultra-detailed 3D render with exquisite rim lighting, vibrant and hyper-realistic textures. Majestic design, imposing presence, polished tones according to (colors of Kylo Ren). Contrasted and meticulously crafted background, high-quality octane rendering, 8K."
144
  ]
145
 
146
- def clear_text_prompt():
147
- return ""
148
-
149
  with gr.Blocks(css=css) as app:
150
  gr.HTML("""
151
  <center>
@@ -156,15 +141,12 @@ with gr.Blocks(css=css) as app:
156
 
157
  with gr.Row():
158
  with gr.Column(scale=1):
159
- with gr.Row():
160
- text_prompt = gr.Textbox(
161
- label="驴Cu谩l fue tu sue帽o?",
162
- placeholder="Describe lo que so帽aste, no omitas ning煤n detalle.",
163
- lines=2,
164
- elem_id="prompt-text-input",
165
- container=True
166
- )
167
- clear_button = gr.Button("X", elem_id="clear-button", variant="secondary", size="sm")
168
 
169
  with gr.Accordion("Opciones Avanzadas", open=False):
170
  negative_prompt = gr.Textbox(
@@ -201,15 +183,17 @@ with gr.Blocks(css=css) as app:
201
  step=0.001
202
  )
203
 
 
204
  gr.Examples(examples=examples, inputs=text_prompt)
205
 
206
  with gr.Row(elem_id="button-container"):
207
  generate_button = gr.Button("QUIERO VER MI SUE脩O", elem_id="generate-button", variant="primary")
 
208
 
209
  with gr.Column(scale=1):
210
  image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
211
 
212
- clear_button.click(clear_text_prompt, outputs=text_prompt)
213
  generate_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, strength], outputs=image_output)
 
214
 
215
  app.launch(show_api=False, share=False)
 
68
  background-color: #f5f5f5; /* Fondo gris claro para inputs */
69
  color: #333333; /* Texto gris oscuro en inputs */
70
  border: 1px solid #cccccc; /* Borde gris claro en inputs */
71
+ width: 100%; /* Ancho completo del input */
72
  box-sizing: border-box; /* Incluir el borde en el ancho total */
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
 
75
  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: 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
 
116
  @media (min-width: 769px) {
117
  .button-container {
118
  display: flex;
119
+ justify-content: flex-end; /* Alinea los botones a la derecha en vista de escritorio */
120
  }
121
 
122
  .button-container button {
 
131
  "((Helmet of Kylo Ren)) in dominant shape of cat, heavily adapted to the physical characteristics of (((cat))), incorporating rugged texture and robust elements. Ultra-detailed 3D render with exquisite rim lighting, vibrant and hyper-realistic textures. Majestic design, imposing presence, polished tones according to (colors of Kylo Ren). Contrasted and meticulously crafted background, high-quality octane rendering, 8K."
132
  ]
133
 
 
 
 
134
  with gr.Blocks(css=css) as app:
135
  gr.HTML("""
136
  <center>
 
141
 
142
  with gr.Row():
143
  with gr.Column(scale=1):
144
+ text_prompt = gr.Textbox(
145
+ label="驴Cu谩l fue tu sue帽o?",
146
+ placeholder="Describe lo que so帽aste, no omitas ning煤n detalle.",
147
+ lines=2,
148
+ elem_id="prompt-text-input"
149
+ )
 
 
 
150
 
151
  with gr.Accordion("Opciones Avanzadas", open=False):
152
  negative_prompt = gr.Textbox(
 
183
  step=0.001
184
  )
185
 
186
+ # Mover el componente de ejemplos aqu铆, justo debajo de Opciones Avanzadas
187
  gr.Examples(examples=examples, inputs=text_prompt)
188
 
189
  with gr.Row(elem_id="button-container"):
190
  generate_button = gr.Button("QUIERO VER MI SUE脩O", elem_id="generate-button", variant="primary")
191
+ clear_button = gr.Button("Clear", elem_id="clear-button", variant="secondary")
192
 
193
  with gr.Column(scale=1):
194
  image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
195
 
 
196
  generate_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, strength], outputs=image_output)
197
+ clear_button.click(lambda: text_prompt.update(value=""), outputs=text_prompt)
198
 
199
  app.launch(show_api=False, share=False)