Spaces:
Runtime error
Runtime error
import streamlit as st | |
from utils import carga_modelo, general | |
## Página principal | |
st.title("generador de mariposas") | |
st.write("Modelo de Ligth Gan en streamlit") | |
## Barra Lateral | |
st.sidebar.subheader("Mariposa Inventada por matematicas") | |
st.sidebar.image("assets/logo.png", width=200) | |
st.sidebar.caption("Rodrigo Rosales") | |
## Carga del Modelo | |
repo_id = "ceyda/butterfly_cropped_uniq1K_512" | |
model_gan = carga_modelo(repo_id) | |
## Cantidad de Mariposas | |
n_mariposas = 4 | |
## Principal | |
def corre(): | |
with st.spinner("Generandose, tranquilo fiera!!!") | |
ims = general(modelo_gan, n_mariposas) | |
st.session_state["ims"] = ims | |
if "ims" not in st.session_state: | |
st.session_state["ims"] = None | |
corre() | |
ims = st.session_state["ims"] | |
corre_boton = st.button( | |
"Generar mariposas", | |
on_click=corre, | |
help="Click para generar mariposas", | |
) | |
if ims is not None: | |
cols = st.columns(n_mariposas) | |
for j, im in enumerate(ims): | |
i = j % n_mariposas | |
cols[i].image(im, use_column_width=True) |