Spaces:
Runtime error
Runtime error
File size: 1,239 Bytes
8552e9f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# Streamlit Library
import streamlit as st
from utils import load_model, generate
# Main Page
# Title
st.title("Butterflies Generator")
# Sumamry Description Model
st.write("This is Light GAN trained model")
# Sidebar
st.sidebar.subheader("This butterfly does not exist!, could you believe it?")
# Logo folder
st.sidebar.image("assets/logo.png", width=200)
#
st.sidebar.caption("Demo live created")
# Loading & Model's Name
repo_id = "ceyda/butterfly_cropped_uniq1K_512"
gan_model = load_model(repo_id)
# Butterflies Generator (4)
n_butterflies = 4
def run():
with st.spinner("Loading, Please! be patient..."):
# Inner Processing
ims = generate(gan_model, n_butterflies)
# To save on
st.session_state["ims"]
if "ims" not in st.session_state:
st.session_state["ims"] = None
run()
# Extracting info from ims
ims = st.session_state["ims"]
#
run_button = st.button(
"Please! Generate buttlerflies",
on_click= run(),
help="we are in flight, fasten your seatbelt."
)
if ims is not None:
cols = st.columns(n_butterflies)
for j, im in enumerate(ims):
i = j % n_butterflies
cols[i].image(im, use_column_width=True)
|