Spaces:
Running
Running
File size: 955 Bytes
daa126b 8abe14f daa126b aa0a746 daa126b aa0a746 8abe14f aa0a746 f7511b7 aa0a746 f7511b7 aa0a746 |
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 |
import streamlit as st
import os
from utils import load_model, generate
st.title('Image Generator with GAN')
st.markdown('Butterflies generator')
st.write("Token Access:", st.secrets["access_token"])
# Sidebar
st.sidebar.subheader('This butterfly does not exist, it is completely generated!')
st.sidebar.image('assets/logo.jpeg', width=200)
st.sidebar.caption('Demo was just created.')
# Loading model
repo_id = 'ceyda/bfutterfly_cropped_uniq1K_512'
gan_model = load_model(repo_id)
# Generate 4 butterflies
n_butterflies = 4
def run():
with st.spinner('Generating...'):
ims = generate(gan_model, n_butterflies)
st.session_state['ims'] = ims
if 'ims' not in st.session_state:
st.session_state['ims'] = None
run()
ims = st.session_state['ims']
run_button = st.button(
'Generate butterflies',
on_click=run,
help='We are about to start to generate'
)
if ims is not None:
cols = st.columns(n_butterflies) |