cstr commited on
Commit
6bbfcbf
·
verified ·
1 Parent(s): 823a14b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -209,6 +209,7 @@ def update_category_models(category):
209
  if cat["category"] == category:
210
  model_names = [model[0] for model in cat["models"]]
211
  if model_names:
 
212
  return model_names, model_names[0]
213
  return [], None
214
  return [], None
@@ -721,7 +722,7 @@ def create_app():
721
  [model[0] for model in MODELS[0]["models"]],
722
  label="Models in Category",
723
  value=MODELS[0]["models"][0][0],
724
- allow_custom_value=True # allow custom values
725
  )
726
 
727
  with gr.Accordion("Generation Parameters", open=False):
@@ -918,6 +919,7 @@ def create_app():
918
  model_categories.change(
919
  fn=update_category_models,
920
  inputs=model_categories,
 
921
  outputs=[category_models, category_models]
922
  )
923
 
 
209
  if cat["category"] == category:
210
  model_names = [model[0] for model in cat["models"]]
211
  if model_names:
212
+ # Return the list of choices first, then the default value
213
  return model_names, model_names[0]
214
  return [], None
215
  return [], None
 
722
  [model[0] for model in MODELS[0]["models"]],
723
  label="Models in Category",
724
  value=MODELS[0]["models"][0][0],
725
+ allow_custom_value=True
726
  )
727
 
728
  with gr.Accordion("Generation Parameters", open=False):
 
919
  model_categories.change(
920
  fn=update_category_models,
921
  inputs=model_categories,
922
+ # The first output updates the choices, the second updates the value
923
  outputs=[category_models, category_models]
924
  )
925