dar-tau commited on
Commit
7f534c5
1 Parent(s): 2a69d25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -44,7 +44,6 @@ def initialize_gpu():
44
 
45
  def reset_model(model_name, *extra_components, with_extra_components=True):
46
  # extract model info
47
- print('HELLO!!')
48
 
49
  model_args = deepcopy(model_info[model_name])
50
  model_path = model_args.pop('model_path')
@@ -63,8 +62,9 @@ def reset_model(model_name, *extra_components, with_extra_components=True):
63
  gc.collect()
64
  if with_extra_components:
65
  for i in range(len(extra_components)):
66
- print('HELLO!!')
67
- return [welcome_message.format(model_name=model_name), *extra_components]
 
68
 
69
 
70
  def get_hidden_states(raw_original_prompt):
@@ -220,8 +220,7 @@ with gr.Blocks(theme=gr.themes.Default(), css='styles.css') as demo:
220
  [progress_dummy, *tokens_container, *interpretation_bubbles])
221
  original_prompt_raw.change(lambda: [gr.Button(visible=False) for _ in range(MAX_PROMPT_TOKENS)], [], tokens_container)
222
 
223
- extra_components = [interpretation_prompt, original_prompt_raw,
224
- original_prompt_btn, *interpretation_bubbles]
225
- model_chooser.change(reset_model, [model_chooser, *extra_components], [welcome_model, *extra_components])
226
 
227
  demo.launch()
 
44
 
45
  def reset_model(model_name, *extra_components, with_extra_components=True):
46
  # extract model info
 
47
 
48
  model_args = deepcopy(model_info[model_name])
49
  model_path = model_args.pop('model_path')
 
62
  gc.collect()
63
  if with_extra_components:
64
  for i in range(len(extra_components)):
65
+ return ([welcome_message.format(model_name=model_name)]
66
+ + [gr.Textbox(visible=False) for _ in range(len(interpretation_bubbles))]
67
+ + extra_components)
68
 
69
 
70
  def get_hidden_states(raw_original_prompt):
 
220
  [progress_dummy, *tokens_container, *interpretation_bubbles])
221
  original_prompt_raw.change(lambda: [gr.Button(visible=False) for _ in range(MAX_PROMPT_TOKENS)], [], tokens_container)
222
 
223
+ extra_components = [interpretation_prompt, original_prompt_raw, original_prompt_btn]
224
+ model_chooser.change(reset_model, [model_chooser, *extra_components], [welcome_model, *interpretation_bubbles, *extra_components])
 
225
 
226
  demo.launch()