Spaces:
Runtime error
Runtime error
Update page/generate.py
Browse files- page/generate.py +17 -15
page/generate.py
CHANGED
|
@@ -47,7 +47,14 @@ def app():
|
|
| 47 |
if( 'results' not in st.session_state ):
|
| 48 |
st.session_state.results = []
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
startButton = holder.button("Start")
|
| 52 |
|
| 53 |
already = []
|
|
@@ -60,20 +67,23 @@ def app():
|
|
| 60 |
|
| 61 |
st.session_state.load_state = True
|
| 62 |
|
|
|
|
|
|
|
| 63 |
placeholder = st.empty()
|
| 64 |
second = st.empty()
|
| 65 |
|
| 66 |
nextButton = False
|
| 67 |
-
|
| 68 |
f = True
|
| 69 |
|
| 70 |
ii = 0
|
| 71 |
-
while len(st.session_state.results) <=
|
| 72 |
|
| 73 |
ii += 1
|
| 74 |
|
| 75 |
if(f and len(st.session_state.results) > 0):
|
| 76 |
f = False
|
|
|
|
| 77 |
nextButton = holder.button("finished generating images")
|
| 78 |
|
| 79 |
with second.container():
|
|
@@ -87,24 +97,16 @@ def app():
|
|
| 87 |
st.session_state.page = 1
|
| 88 |
break
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
#if(ii % 2 == 1):
|
| 93 |
-
generate2(prompt,crazy,k)
|
| 94 |
-
#generate(prompt ,crazy,k)
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
if ii % 6 == 0:
|
| 98 |
_1 = ["A modern ","A post-modern ","An ultramodern ", "A classical ", "A parametric ", "A contemporary ", "A minimalist "]
|
| 99 |
_2 = ["museum architecture","home architecture","landscape architecture","interior design","structure architecture"]
|
| 100 |
_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"]
|
| 101 |
_4 = [" photograph",", watercolor painting",", oil painting", ", digital art"]
|
| 102 |
|
| 103 |
prompt = str(random.choice(_1)+random.choice(_2)+random.choice(_3)+random.choice(_4))
|
| 104 |
-
|
| 105 |
|
| 106 |
-
|
| 107 |
-
k = random.randrange(1,2500)
|
| 108 |
-
|
| 109 |
|
| 110 |
st.session_state.bar = st.container()
|
|
|
|
| 47 |
if( 'results' not in st.session_state ):
|
| 48 |
st.session_state.results = []
|
| 49 |
|
| 50 |
+
|
| 51 |
+
c1,c2 = st.columns(2)
|
| 52 |
+
|
| 53 |
+
with c1:
|
| 54 |
+
holder = st.empty()
|
| 55 |
+
with c2:
|
| 56 |
+
holder2 = st.empty()
|
| 57 |
+
|
| 58 |
startButton = holder.button("Start")
|
| 59 |
|
| 60 |
already = []
|
|
|
|
| 67 |
|
| 68 |
st.session_state.load_state = True
|
| 69 |
|
| 70 |
+
|
| 71 |
+
|
| 72 |
placeholder = st.empty()
|
| 73 |
second = st.empty()
|
| 74 |
|
| 75 |
nextButton = False
|
| 76 |
+
randomButton = False
|
| 77 |
f = True
|
| 78 |
|
| 79 |
ii = 0
|
| 80 |
+
while len(st.session_state.results) <= 128:
|
| 81 |
|
| 82 |
ii += 1
|
| 83 |
|
| 84 |
if(f and len(st.session_state.results) > 0):
|
| 85 |
f = False
|
| 86 |
+
randomButton = holder2.button("randomize prompt")
|
| 87 |
nextButton = holder.button("finished generating images")
|
| 88 |
|
| 89 |
with second.container():
|
|
|
|
| 97 |
st.session_state.page = 1
|
| 98 |
break
|
| 99 |
|
| 100 |
+
if(randomButton):
|
| 101 |
+
randomButton = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
_1 = ["A modern ","A post-modern ","An ultramodern ", "A classical ", "A parametric ", "A contemporary ", "A minimalist "]
|
| 103 |
_2 = ["museum architecture","home architecture","landscape architecture","interior design","structure architecture"]
|
| 104 |
_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"]
|
| 105 |
_4 = [" photograph",", watercolor painting",", oil painting", ", digital art"]
|
| 106 |
|
| 107 |
prompt = str(random.choice(_1)+random.choice(_2)+random.choice(_3)+random.choice(_4))
|
| 108 |
+
st.session_state.prompt = prompt
|
| 109 |
|
| 110 |
+
generate2(prompt,crazy,k)
|
|
|
|
|
|
|
| 111 |
|
| 112 |
st.session_state.bar = st.container()
|