ai_architecture / page /generate.py
JMalott's picture
Update page/generate.py
e6e7f9c
raw
history blame
2.57 kB
import collections
from numpy.core.defchararray import lower
import streamlit as st
import numpy as np
import pandas as pd
import streamlit as st
import pandas as pd
import numpy as np
import os, random, time
from utils import footer, generate, drawGrid
from PIL import Image
mode = "ai"
#mode = "dummy"
def app():
st.title('AI-Generated Architecture')
st.subheader('(beta v1.0)')
st.text('This is a working beta version with bugs. Known issues are:\n-Some images will grey out when you change the input parameters')
st.subheader('Describe a building, interior, or other architecture you would like to see.')
#Modern architecture museum with black brick and large windows.
prompt = st.text_input(label="",value="Modern architecture museum with black brick and large windows.")
st.text("")
with st.expander("Having trouble thinking of something? Click here to view examples."):
st.write("""
• Modern architecture museum with black brick and large windows.\n
• A prosaic, simple architecture.\n
• An urban, post-modern architecture with concrete and steel.\n
• A sleek urban interior design.
""")
st.text("")
crazy = st.slider('Temperature. This controls how "crazy" generated images are, where 0 is the least crazy.', 0.0, 1.0, 0.75)
k = st.slider('Top K. The higher the value, the higher quality the results tend to be at the cost of extra processing time.', 1, 10, 1)
if( 'results' not in st.session_state ):
st.session_state.results = []
holder = st.empty()
startButton = holder.button("Start")
already = []
if startButton or hasattr(st.session_state, 'load_state'):
with st.spinner("Generating..."):
holder.empty()
nextButton = holder.button("finished generating images")
st.session_state.load_state = True
placeholder = st.empty()
second = st.empty()
#with second.container():
# drawGrid()
while len(st.session_state.results) <= 64:
with second.container():
drawGrid()
with placeholder.container():
st.session_state.bar = placeholder.progress(0)
if(nextButton):
st.session_state.page = 1
break
generate( prompt ,crazy,k)
st.session_state.bar = st.container()