Spaces:
Running
Running
salomonsky
commited on
Commit
•
6bfa7bf
1
Parent(s):
f653ed1
Update app.py
Browse files
app.py
CHANGED
@@ -124,14 +124,14 @@ def login_form():
|
|
124 |
else:
|
125 |
st.error("Credenciales incorrectas. Intenta de nuevo.")
|
126 |
|
127 |
-
async def generate_variations(prompt, num_variants, use_enhanced):
|
128 |
prompts = set()
|
129 |
while len(prompts) < num_variants:
|
130 |
if use_enhanced:
|
131 |
-
enhanced_prompt = await improve_prompt(prompt)
|
132 |
prompts.add(enhanced_prompt)
|
133 |
else:
|
134 |
-
prompts.add(prompt)
|
135 |
return list(prompts)
|
136 |
|
137 |
async def main():
|
@@ -146,6 +146,8 @@ async def main():
|
|
146 |
format_option = st.sidebar.selectbox("Formato", ["9:16", "16:9", "1:1"])
|
147 |
prompt_checkbox = st.sidebar.checkbox("Mejorar Prompt")
|
148 |
model_option = st.sidebar.selectbox("Modelo", ["black-forest-labs/FLUX.1-schnell", "black-forest-labs/FLUX.1-dev"])
|
|
|
|
|
149 |
width, height = (360, 640) if format_option == "9:16" else (640, 360) if format_option == "16:9" else (640, 640)
|
150 |
|
151 |
if prompt_checkbox:
|
@@ -155,9 +157,9 @@ async def main():
|
|
155 |
|
156 |
if prompt_checkbox:
|
157 |
with st.spinner("Generando prompts mejorados..."):
|
158 |
-
prompts = await generate_variations(prompt, num_variants, True)
|
159 |
else:
|
160 |
-
prompts = [prompt]
|
161 |
|
162 |
if st.sidebar.button("Generar Imágenes"):
|
163 |
with st.spinner("Generando imágenes..."):
|
@@ -171,5 +173,6 @@ async def main():
|
|
171 |
|
172 |
display_gallery()
|
173 |
|
|
|
174 |
if __name__ == "__main__":
|
175 |
asyncio.run(main())
|
|
|
124 |
else:
|
125 |
st.error("Credenciales incorrectas. Intenta de nuevo.")
|
126 |
|
127 |
+
async def generate_variations(prompt, num_variants, use_enhanced, style):
|
128 |
prompts = set()
|
129 |
while len(prompts) < num_variants:
|
130 |
if use_enhanced:
|
131 |
+
enhanced_prompt = await improve_prompt(f"{prompt}, estilo: {style}")
|
132 |
prompts.add(enhanced_prompt)
|
133 |
else:
|
134 |
+
prompts.add(f"{prompt}, estilo: {style}")
|
135 |
return list(prompts)
|
136 |
|
137 |
async def main():
|
|
|
146 |
format_option = st.sidebar.selectbox("Formato", ["9:16", "16:9", "1:1"])
|
147 |
prompt_checkbox = st.sidebar.checkbox("Mejorar Prompt")
|
148 |
model_option = st.sidebar.selectbox("Modelo", ["black-forest-labs/FLUX.1-schnell", "black-forest-labs/FLUX.1-dev"])
|
149 |
+
style_option = st.sidebar.selectbox("Estilo", ["realista", "hiperrealista", "photorealista", "imaginativo", "abstracto", "moebius"])
|
150 |
+
|
151 |
width, height = (360, 640) if format_option == "9:16" else (640, 360) if format_option == "16:9" else (640, 640)
|
152 |
|
153 |
if prompt_checkbox:
|
|
|
157 |
|
158 |
if prompt_checkbox:
|
159 |
with st.spinner("Generando prompts mejorados..."):
|
160 |
+
prompts = await generate_variations(prompt, num_variants, True, style_option)
|
161 |
else:
|
162 |
+
prompts = [f"{prompt}, estilo: {style_option}"]
|
163 |
|
164 |
if st.sidebar.button("Generar Imágenes"):
|
165 |
with st.spinner("Generando imágenes..."):
|
|
|
173 |
|
174 |
display_gallery()
|
175 |
|
176 |
+
|
177 |
if __name__ == "__main__":
|
178 |
asyncio.run(main())
|