ceyda commited on
Commit
9530865
1 Parent(s): 580e783

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -30,8 +30,9 @@ def load_dataset():
30
 
31
  @st.experimental_singleton
32
  def load_variables():# Don't want to open read files over and over. not sure if it makes a diff
33
- st.session_state['latent_walk_code']=open("assets/code_snippets/latent_walk.py").read()
34
- st.session_state['latent_walk_code_music']=open("assets/code_snippets/latent_walk_music.py").read()
 
35
 
36
  def img2download(image):
37
  imgByteArr = io.BytesIO()
@@ -44,7 +45,7 @@ model_version='57d36a15546909557d9f967f47713236c8288838'
44
  # model_version=None
45
  model=load_model_intocache(model_name,model_version)
46
  dataset=load_dataset()
47
- load_variables()
48
 
49
  generate_menu="🦋 Make butterflies"
50
  latent_walk_menu="🎧 Take a latent walk"
@@ -90,8 +91,6 @@ Based on [paper:](https://openreview.net/forum?id=1Fqg133qRaI) *Towards Faster a
90
 
91
  elif screen == latent_walk_menu:
92
 
93
- latent_walk_code=open("assets/code_snippets/latent_walk.py").read()
94
- latent_walk_music_code=open("assets/code_snippets/latent_walk_music.py").read()
95
  st.write("Take a latent walk :musical_note: with cute butterflies")
96
 
97
  cols=st.columns(3)
@@ -108,9 +107,9 @@ elif screen == latent_walk_menu:
108
  st.write("🎧Did those butterflies seem to be dancing to the music?!Here is the secret:")
109
  with st.expander("See the Code Snippets"):
110
  st.write("A regular latent walk:")
111
- st.code(st.session_state['latent_walk_code'], language='python')
112
  st.write(":musical_note: latent walk with music:")
113
- st.code(st.session_state['latent_walk_code_music'], language='python')
114
 
115
 
116
  elif screen == make_meme_menu:
 
30
 
31
  @st.experimental_singleton
32
  def load_variables():# Don't want to open read files over and over. not sure if it makes a diff
33
+ latent_walk_code=open("assets/code_snippets/latent_walk.py").read()
34
+ latent_walk_code_music=open("assets/code_snippets/latent_walk_music.py").read()
35
+ return latent_walk_code,latent_walk_code_music
36
 
37
  def img2download(image):
38
  imgByteArr = io.BytesIO()
 
45
  # model_version=None
46
  model=load_model_intocache(model_name,model_version)
47
  dataset=load_dataset()
48
+ latent_walk_code, latent_walk_code_music=load_variables()
49
 
50
  generate_menu="🦋 Make butterflies"
51
  latent_walk_menu="🎧 Take a latent walk"
 
91
 
92
  elif screen == latent_walk_menu:
93
 
 
 
94
  st.write("Take a latent walk :musical_note: with cute butterflies")
95
 
96
  cols=st.columns(3)
 
107
  st.write("🎧Did those butterflies seem to be dancing to the music?!Here is the secret:")
108
  with st.expander("See the Code Snippets"):
109
  st.write("A regular latent walk:")
110
+ st.code(latent_walk_code, language='python')
111
  st.write(":musical_note: latent walk with music:")
112
+ st.code(latent_walk_code_music, language='python')
113
 
114
 
115
  elif screen == make_meme_menu: