Spaces:
Running
Running
salomonsky
commited on
Commit
•
a679a82
1
Parent(s):
4303f32
Update app.py
Browse files
app.py
CHANGED
@@ -96,7 +96,7 @@ def save_image(image, file_name, prompt=None):
|
|
96 |
save_prompt(f"{file_name}: {prompt}")
|
97 |
return image_path
|
98 |
|
99 |
-
async def generate_image(prompt, width, height, seed, model_name
|
100 |
if seed == -1:
|
101 |
seed = random.randint(0, MAX_SEED)
|
102 |
image = await client.text_to_image(prompt=prompt, height=height, width=width, model=model_name)
|
@@ -145,6 +145,7 @@ async def main():
|
|
145 |
prompt = st.sidebar.text_area("Descripción de la imagen", height=150, max_chars=500)
|
146 |
format_option = st.sidebar.selectbox("Formato", ["9:16", "16:9", "1:1"])
|
147 |
prompt_checkbox = st.sidebar.checkbox("Mejorar Prompt")
|
|
|
148 |
style_option = st.sidebar.selectbox("Estilo", ["realista", "hiperrealista", "photorealista", "imaginativo", "abstracto", "moebius"])
|
149 |
|
150 |
width, height = (360, 640) if format_option == "9:16" else (640, 360) if format_option == "16:9" else (640, 640)
|
@@ -163,7 +164,7 @@ async def main():
|
|
163 |
if st.sidebar.button("Generar Imágenes"):
|
164 |
with st.spinner("Generando imágenes..."):
|
165 |
try:
|
166 |
-
results = await gen(prompts, width, height,
|
167 |
st.session_state['generated_image_paths'] = results
|
168 |
for result in results:
|
169 |
st.image(result, caption="Imagen Generada")
|
@@ -174,4 +175,4 @@ async def main():
|
|
174 |
|
175 |
|
176 |
if __name__ == "__main__":
|
177 |
-
asyncio.run(main())
|
|
|
96 |
save_prompt(f"{file_name}: {prompt}")
|
97 |
return image_path
|
98 |
|
99 |
+
async def generate_image(prompt, width, height, seed, model_name):
|
100 |
if seed == -1:
|
101 |
seed = random.randint(0, MAX_SEED)
|
102 |
image = await client.text_to_image(prompt=prompt, height=height, width=width, model=model_name)
|
|
|
145 |
prompt = st.sidebar.text_area("Descripción de la imagen", height=150, max_chars=500)
|
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)
|
|
|
164 |
if st.sidebar.button("Generar Imágenes"):
|
165 |
with st.spinner("Generando imágenes..."):
|
166 |
try:
|
167 |
+
results = await gen(prompts, width, height, model_option, num_variants, prompt_checkbox)
|
168 |
st.session_state['generated_image_paths'] = results
|
169 |
for result in results:
|
170 |
st.image(result, caption="Imagen Generada")
|
|
|
175 |
|
176 |
|
177 |
if __name__ == "__main__":
|
178 |
+
asyncio.run(main())
|