Spaces:
Runtime error
Runtime error
| 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('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 = [] | |
| print("-0-") | |
| if startButton or hasattr(st.session_state, 'load_state'): | |
| with st.spinner("Generating..."): | |
| print("-1-") | |
| 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) <= 15: | |
| print("Length "+str(len(st.session_state.results))) | |
| with placeholder.container(): | |
| st.session_state.bar = placeholder.progress(0) | |
| if(nextButton): | |
| st.session_state.page = 1 | |
| break | |
| generate(prompt,crazy,k) | |
| with second.container(): | |
| drawGrid() | |
| #placeholder.empty() | |
| #st.session_state.bar = placeholder.progress(0) | |
| #drawGrid(placeholder) | |