Spaces:
Running
Running
salomonsky
commited on
Commit
•
d8f32ab
1
Parent(s):
450c3d6
Update app.py
Browse files
app.py
CHANGED
@@ -63,9 +63,10 @@ def improve_prompt(prompt):
|
|
63 |
instruction = "Mejora mi prompt para texto a imagen en inglés con estilo, cinematografía, cámaras, atmósfera e iluminación para la mejor calidad, de máximo 200 palabras."
|
64 |
formatted_prompt = f"{instruction}: {prompt}"
|
65 |
response = llm_client.text_generation(formatted_prompt, max_new_tokens=200)
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
69 |
return improved_text.strip()
|
70 |
except Exception as e:
|
71 |
return f"Error mejorando el prompt: {e}"
|
@@ -81,22 +82,24 @@ with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
|
|
81 |
output_res = ImageSlider(label="Flux / Upscaled")
|
82 |
with gr.Column(scale=2):
|
83 |
prompt = gr.Textbox(label="Descripción de imágen")
|
84 |
-
improved_prompt = gr.Textbox(label="Prompt Mejorado", interactive=False)
|
85 |
-
improve_btn = gr.Button("Mejora mi prompt")
|
86 |
basemodel_choice = gr.Dropdown(label="Modelo", choices=["black-forest-labs/FLUX.1-schnell", "black-forest-labs/FLUX.1-DEV"], value="black-forest-labs/FLUX.1-schnell")
|
87 |
lora_model_choice = gr.Dropdown(label="LORA Realismo", choices=["Shakker-Labs/FLUX.1-dev-LoRA-add-details", "XLabs-AI/flux-RealismLora"], value="XLabs-AI/flux-RealismLora")
|
88 |
process_lora = gr.Checkbox(label="Procesar LORA")
|
89 |
process_upscale = gr.Checkbox(label="Procesar Escalador")
|
90 |
upscale_factor = gr.Radio(label="Factor de Escala", choices=[2, 4, 8], value=2)
|
|
|
|
|
|
|
|
|
91 |
improve_btn.click(fn=improve_prompt, inputs=[prompt], outputs=improved_prompt)
|
92 |
-
|
93 |
with gr.Accordion(label="Opciones Avanzadas", open=False):
|
94 |
width = gr.Slider(label="Ancho", minimum=512, maximum=1280, step=8, value=1280)
|
95 |
height = gr.Slider(label="Alto", minimum=512, maximum=1280, step=8, value=768)
|
96 |
scales = gr.Slider(label="Escalado", minimum=1, maximum=20, step=1, value=10)
|
97 |
-
steps = gr.Slider(label="Pasos", minimum=1, maximum
|
98 |
seed = gr.Number(label="Semilla", value=-1)
|
99 |
-
|
100 |
btn = gr.Button("Generar")
|
101 |
btn.click(fn=gen, inputs=[improved_prompt, basemodel_choice, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model_choice, process_lora], outputs=output_res)
|
102 |
demo.launch()
|
|
|
63 |
instruction = "Mejora mi prompt para texto a imagen en inglés con estilo, cinematografía, cámaras, atmósfera e iluminación para la mejor calidad, de máximo 200 palabras."
|
64 |
formatted_prompt = f"{instruction}: {prompt}"
|
65 |
response = llm_client.text_generation(formatted_prompt, max_new_tokens=200)
|
66 |
+
|
67 |
+
# Aquí asumimos que la respuesta es un string completo, no una lista de objetos.
|
68 |
+
improved_text = response # Se espera que 'response' sea una cadena de texto.
|
69 |
+
|
70 |
return improved_text.strip()
|
71 |
except Exception as e:
|
72 |
return f"Error mejorando el prompt: {e}"
|
|
|
82 |
output_res = ImageSlider(label="Flux / Upscaled")
|
83 |
with gr.Column(scale=2):
|
84 |
prompt = gr.Textbox(label="Descripción de imágen")
|
|
|
|
|
85 |
basemodel_choice = gr.Dropdown(label="Modelo", choices=["black-forest-labs/FLUX.1-schnell", "black-forest-labs/FLUX.1-DEV"], value="black-forest-labs/FLUX.1-schnell")
|
86 |
lora_model_choice = gr.Dropdown(label="LORA Realismo", choices=["Shakker-Labs/FLUX.1-dev-LoRA-add-details", "XLabs-AI/flux-RealismLora"], value="XLabs-AI/flux-RealismLora")
|
87 |
process_lora = gr.Checkbox(label="Procesar LORA")
|
88 |
process_upscale = gr.Checkbox(label="Procesar Escalador")
|
89 |
upscale_factor = gr.Radio(label="Factor de Escala", choices=[2, 4, 8], value=2)
|
90 |
+
|
91 |
+
improved_prompt = gr.Textbox(label="Prompt Mejorado", interactive=False)
|
92 |
+
|
93 |
+
improve_btn = gr.Button("Mejora mi prompt")
|
94 |
improve_btn.click(fn=improve_prompt, inputs=[prompt], outputs=improved_prompt)
|
95 |
+
|
96 |
with gr.Accordion(label="Opciones Avanzadas", open=False):
|
97 |
width = gr.Slider(label="Ancho", minimum=512, maximum=1280, step=8, value=1280)
|
98 |
height = gr.Slider(label="Alto", minimum=512, maximum=1280, step=8, value=768)
|
99 |
scales = gr.Slider(label="Escalado", minimum=1, maximum=20, step=1, value=10)
|
100 |
+
steps = gr.Slider(label="Pasos", minimum=1, maximum 100, step=1, value=20)
|
101 |
seed = gr.Number(label="Semilla", value=-1)
|
102 |
+
|
103 |
btn = gr.Button("Generar")
|
104 |
btn.click(fn=gen, inputs=[improved_prompt, basemodel_choice, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model_choice, process_lora], outputs=output_res)
|
105 |
demo.launch()
|