JeCabrera commited on
Commit
754fa07
·
verified ·
1 Parent(s): 46ad785

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -18
app.py CHANGED
@@ -64,28 +64,25 @@ css = """
64
  padding: 20px; /* Espacio interno */
65
  }
66
 
67
- .input-container {
68
- position: relative;
69
- width: 100%;
70
- }
71
-
72
  input, textarea, select {
73
  background-color: #f5f5f5; /* Fondo gris claro para inputs */
74
  color: #333333; /* Texto gris oscuro en inputs */
75
  border: 1px solid #cccccc; /* Borde gris claro en inputs */
76
- width: 100%; /* Ancho completo del input */
77
  box-sizing: border-box; /* Incluir el borde en el ancho total */
78
- padding-right: 30px; /* Espacio para el botón "x" */
79
  }
80
 
81
  .clear-button {
82
  position: absolute;
83
- right: 5px;
84
  top: 50%;
85
  transform: translateY(-50%);
 
 
86
  cursor: pointer;
87
- color: #666;
88
- font-size: 14px;
89
  }
90
 
91
  button {
@@ -146,6 +143,9 @@ examples = [
146
  "((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."
147
  ]
148
 
 
 
 
149
  with gr.Blocks(css=css) as app:
150
  gr.HTML("""
151
  <center>
@@ -156,13 +156,16 @@ with gr.Blocks(css=css) as app:
156
 
157
  with gr.Row():
158
  with gr.Column(scale=1):
159
- gr.HTML("""
160
- <div class="input-container">
161
- <input type="text" id="prompt-text-input" placeholder="Describe lo que soñaste, no omitas ningún detalle." />
162
- <span class="clear-button" onclick="document.getElementById('prompt-text-input').value=''">×</span>
163
- </div>
164
- """)
165
-
 
 
 
166
  with gr.Accordion("Opciones Avanzadas", open=False):
167
  negative_prompt = gr.Textbox(
168
  label="¿Qué elementos no deseas que se plasmen de tu sueño?",
@@ -198,7 +201,6 @@ with gr.Blocks(css=css) as app:
198
  step=0.001
199
  )
200
 
201
- # Mover el componente de ejemplos aquí, justo debajo de Opciones Avanzadas
202
  gr.Examples(examples=examples, inputs=text_prompt)
203
 
204
  with gr.Row(elem_id="button-container"):
@@ -207,6 +209,7 @@ with gr.Blocks(css=css) as app:
207
  with gr.Column(scale=1):
208
  image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
209
 
 
210
  generate_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, strength], outputs=image_output)
211
 
212
  app.launch(show_api=False, share=False)
 
64
  padding: 20px; /* Espacio interno */
65
  }
66
 
 
 
 
 
 
67
  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 {
 
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
 
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(
171
  label="¿Qué elementos no deseas que se plasmen de tu sueño?",
 
201
  step=0.001
202
  )
203
 
 
204
  gr.Examples(examples=examples, inputs=text_prompt)
205
 
206
  with gr.Row(elem_id="button-container"):
 
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)