File size: 3,812 Bytes
44df93e
 
 
 
 
 
 
 
 
c0cc5ae
44df93e
 
 
 
 
 
c0cc5ae
44df93e
 
 
c0cc5ae
46b1fdf
c0cc5ae
e6e7f9c
c0cc5ae
44df93e
 
c0cc5ae
 
44df93e
 
 
c0cc5ae
 
 
 
 
 
 
44df93e
 
 
 
c0cc5ae
 
44df93e
 
 
 
 
 
 
 
 
c0cc5ae
44df93e
c0cc5ae
44df93e
 
 
 
 
 
 
 
c0cc5ae
 
 
 
 
 
44df93e
c0cc5ae
 
 
 
 
44df93e
46b1fdf
 
44df93e
 
 
 
 
c0cc5ae
44df93e
 
 
 
c0cc5ae
 
 
 
 
 
 
 
 
 
 
 
 
 
44df93e
c0cc5ae
 
44df93e
 
46b1fdf
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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, generate2
from PIL import Image

mode = "ai"
#mode = "dummy"

def app():
    global _prompt

    st.title('AI-Generated Architecture')

    #st.subheader('(beta v1.1)')

    #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. You can change the prompt and input parameters on the fly.')

    #Modern architecture museum with black brick and large windows.
    print("Prompt: "+st.session_state.prompt)
    prompt = st.text_input(label="",value=st.session_state.prompt)

    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, 5)
    k = k*400

    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') or st.session_state.prompt is not None:

        with st.spinner("Generating..."):

            holder.empty()

            st.session_state.load_state = True

            placeholder = st.empty()
            second = st.empty()

            nextButton = False
            
            f = True

            ii = 0
            while len(st.session_state.results) <= 4*64:

                ii += 1

                if(f and len(st.session_state.results) > 0):
                    f = False
                    nextButton = holder.button("finished generating images")    

                with second.container():
                    drawGrid()

                with placeholder.container():

                    st.session_state.bar = placeholder.progress(0)
                    
                    if(len(st.session_state.results) > 0 and nextButton):
                        st.session_state.page = 1
                        break

                    
                
                #if(ii % 2 == 1):
                generate2(prompt,crazy,k)
                #generate(prompt ,crazy,k)


                if ii % 6 == 0:
                    _1 = ["A modern ","A post-modern ","An ultramodern ", "A classical ", "A parametric ", "A contemporary ", "A minimalist "]
                    _2 = ["museum architecture","home architecture","landscape architecture","interior design","structure architecture"]
                    _3 = [""," in the style of I.M. Pei"," in the style of Frank Gehry"," in the style of John Lautner"," in the style of Frank Lloyd Wright"]
                    _4 = [" photograph",", watercolor painting",", oil painting", ", digital art"]

                    prompt = str(random.choice(_1)+random.choice(_2)+random.choice(_3)+random.choice(_4))
                    print("swap")

                    crazy = random.random()*2
                    k = random.randrange(1,2500)
                

            st.session_state.bar = st.container()