brayden-gg commited on
Commit
1170f3b
1 Parent(s): ce4b784

using Variable instead of State

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -158,29 +158,29 @@ _wrds, all_word_mdn_Ws_DEFAULT, all_word_mdn_Cs_DEFAULT, _html, _file, _btn, _ma
158
  _sldr, char_Cs_DEFAULT, _chrs, _html, _file, _btn, _wght, char_svg_DEFAULT = update_blend_chars(*char_chosen_DEFAULT, char_weight_DEFAULT, char_Ws_DEFAULT)
159
 
160
  with gr.Blocks() as demo:
161
- all_loaded_data_var = gr.State(all_loaded_data_DEFAULT)
162
- chosen_writers_var = gr.State(chosen_writers_DEFAULT)
163
  # data for writer interpolation
164
- writer_words_var = gr.State(writer_words_DEFAULT)
165
- writer_mean_Ws_var = gr.State(writer_mean_Ws_DEFAULT)
166
- writer_all_word_Ws_var = gr.State([e.detach() for e in writer_all_word_Ws_DEFAULT])
167
- writer_all_word_Cs_var = gr.State([e.detach() for e in writer_all_word_Cs_DEFAULT])
168
- writer_weight_var = gr.State(writer_weight_DEFAULT)
169
- writer_svg_var = gr.State(writer_svg_DEFAULT)
170
  # data for char interpolation
171
- char_chosen_var = gr.State(char_chosen_DEFAULT)
172
- char_mean_global_W_var = gr.State(char_mean_global_W_DEFAULT)
173
- char_weight_var = gr.State(char_weight_DEFAULT)
174
- char_Ws_var = gr.State(char_Ws_DEFAULT.detach())
175
- char_Cs_var = gr.State(char_Cs_DEFAULT.detach())
176
- char_svg_var = gr.State(char_svg_DEFAULT)
177
  # # data for MDN
178
- mdn_words_var = gr.State(mdn_words_DEFAULT)
179
- all_word_mdn_Ws_var = gr.State([e.detach() for e in all_word_mdn_Ws_DEFAULT])
180
- all_word_mdn_Cs_var = gr.State([e.detach() for e in all_word_mdn_Cs_DEFAULT])
181
- clamp_mdn_var = gr.State(clamp_mdn_DEFAULT)
182
- scale_sd_var = gr.State(scale_sd_DEFAULT)
183
- mdn_svg_var = gr.State(mdn_svg_DEFAULT)
184
 
185
  with gr.Tabs():
186
  with gr.TabItem("Blend Writers"):
 
158
  _sldr, char_Cs_DEFAULT, _chrs, _html, _file, _btn, _wght, char_svg_DEFAULT = update_blend_chars(*char_chosen_DEFAULT, char_weight_DEFAULT, char_Ws_DEFAULT)
159
 
160
  with gr.Blocks() as demo:
161
+ all_loaded_data_var = gr.Variable(all_loaded_data_DEFAULT)
162
+ chosen_writers_var = gr.Variable(chosen_writers_DEFAULT)
163
  # data for writer interpolation
164
+ writer_words_var = gr.Variable(writer_words_DEFAULT)
165
+ writer_mean_Ws_var = gr.Variable(writer_mean_Ws_DEFAULT)
166
+ writer_all_word_Ws_var = gr.Variable([e.detach() for e in writer_all_word_Ws_DEFAULT])
167
+ writer_all_word_Cs_var = gr.Variable([e.detach() for e in writer_all_word_Cs_DEFAULT])
168
+ writer_weight_var = gr.Variable(writer_weight_DEFAULT)
169
+ writer_svg_var = gr.Variable(writer_svg_DEFAULT)
170
  # data for char interpolation
171
+ char_chosen_var = gr.Variable(char_chosen_DEFAULT)
172
+ char_mean_global_W_var = gr.Variable(char_mean_global_W_DEFAULT)
173
+ char_weight_var = gr.Variable(char_weight_DEFAULT)
174
+ char_Ws_var = gr.Variable(char_Ws_DEFAULT.detach())
175
+ char_Cs_var = gr.Variable(char_Cs_DEFAULT.detach())
176
+ char_svg_var = gr.Variable(char_svg_DEFAULT)
177
  # # data for MDN
178
+ mdn_words_var = gr.Variable(mdn_words_DEFAULT)
179
+ all_word_mdn_Ws_var = gr.Variable([e.detach() for e in all_word_mdn_Ws_DEFAULT])
180
+ all_word_mdn_Cs_var = gr.Variable([e.detach() for e in all_word_mdn_Cs_DEFAULT])
181
+ clamp_mdn_var = gr.Variable(clamp_mdn_DEFAULT)
182
+ scale_sd_var = gr.Variable(scale_sd_DEFAULT)
183
+ mdn_svg_var = gr.Variable(mdn_svg_DEFAULT)
184
 
185
  with gr.Tabs():
186
  with gr.TabItem("Blend Writers"):