Clémentine commited on
Commit
99dd7b3
·
1 Parent(s): 510a6cc

change for model init in relaunch

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -56,12 +56,10 @@ def create_app() -> gr.Blocks:
56
  gr.Markdown("## Relaunch Individual Job")
57
 
58
  # Load model-provider combinations
59
- models_providers = load_models_providers(LOCAL_CONFIG_FILE)
60
- model_choices = sorted(list(set([mp[0] for mp in models_providers])))
61
 
62
  relaunch_model = gr.Dropdown(
63
  label="Model",
64
- choices=model_choices,
65
  interactive=True
66
  )
67
  relaunch_provider = gr.Dropdown(
@@ -71,6 +69,12 @@ def create_app() -> gr.Blocks:
71
  )
72
  relaunch_btn = gr.Button("Relaunch Job", variant="secondary")
73
 
 
 
 
 
 
 
74
  def update_provider_choices(model: Optional[str]) -> gr.update:
75
  """Update provider dropdown based on selected model."""
76
  if not model:
@@ -88,6 +92,11 @@ def create_app() -> gr.Blocks:
88
  outputs=output
89
  )
90
 
 
 
 
 
 
91
  launch_btn.click(
92
  fn=launch_jobs,
93
  outputs=output
 
56
  gr.Markdown("## Relaunch Individual Job")
57
 
58
  # Load model-provider combinations
 
 
59
 
60
  relaunch_model = gr.Dropdown(
61
  label="Model",
62
+ choices=[],
63
  interactive=True
64
  )
65
  relaunch_provider = gr.Dropdown(
 
69
  )
70
  relaunch_btn = gr.Button("Relaunch Job", variant="secondary")
71
 
72
+ def update_model_choices() -> gr.update:
73
+ models_providers = load_models_providers(LOCAL_CONFIG_FILE)
74
+ model_choices = sorted(list(set([mp[0] for mp in models_providers])))
75
+ return gr.update(choices=model_choices, value=model_choices[0] if model_choices else None)
76
+
77
+
78
  def update_provider_choices(model: Optional[str]) -> gr.update:
79
  """Update provider dropdown based on selected model."""
80
  if not model:
 
92
  outputs=output
93
  )
94
 
95
+ init_btn.click(
96
+ fn=update_model_choices,
97
+ outputs=relaunch_model
98
+ )
99
+
100
  launch_btn.click(
101
  fn=launch_jobs,
102
  outputs=output