Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -281,11 +281,36 @@ Produce a pro level styled and tuned them GUI that has 1 button that when presse
|
|
| 281 |
if strategist_default:
|
| 282 |
initial_strategist_provider = classify_model_by_provider(strategist_default)
|
| 283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
def load_demo_data():
|
| 285 |
# TASK 2: "Load Demo" Button Model Switch
|
| 286 |
# Switch to a high-end model for the demo
|
| 287 |
-
demo_model_label = "gemini-2.5-pro"
|
| 288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
|
| 290 |
def start_execution_sequence():
|
| 291 |
return gr.update(visible=False), gr.update(visible=True), gr.update(visible=False)
|
|
@@ -316,8 +341,8 @@ Produce a pro level styled and tuned them GUI that has 1 button that when presse
|
|
| 316 |
coder_models_for_reset = CLIENT_CONFIG['coder_by_provider'].get(initial_coder_provider, [])
|
| 317 |
strategist_models_for_reset = CLIENT_CONFIG['strategist_by_provider'].get(initial_strategist_provider, [])
|
| 318 |
|
| 319 |
-
coder_reset_value =
|
| 320 |
-
strategist_reset_value =
|
| 321 |
|
| 322 |
return (
|
| 323 |
"", # blueprint_input
|
|
@@ -350,7 +375,7 @@ Produce a pro level styled and tuned them GUI that has 1 button that when presse
|
|
| 350 |
)
|
| 351 |
coder_model = gr.Dropdown(
|
| 352 |
choices=CLIENT_CONFIG['coder_by_provider'].get(initial_coder_provider, []),
|
| 353 |
-
value=
|
| 354 |
label="Model",
|
| 355 |
interactive=True
|
| 356 |
)
|
|
@@ -399,7 +424,7 @@ Produce a pro level styled and tuned them GUI that has 1 button that when presse
|
|
| 399 |
)
|
| 400 |
strategist_model = gr.Dropdown(
|
| 401 |
choices=CLIENT_CONFIG['strategist_by_provider'].get(initial_strategist_provider, []),
|
| 402 |
-
value=
|
| 403 |
label="Model",
|
| 404 |
interactive=True
|
| 405 |
)
|
|
|
|
| 281 |
if strategist_default:
|
| 282 |
initial_strategist_provider = classify_model_by_provider(strategist_default)
|
| 283 |
|
| 284 |
+
# TASK 1: Set Default Models on Launch
|
| 285 |
+
# We override the config default if specific models are requested
|
| 286 |
+
default_model_label = "gemini-2.0-flash-lite" # Assumes this key exists in config
|
| 287 |
+
|
| 288 |
+
# Helper to safely get a default value
|
| 289 |
+
def get_safe_default(provider, preferred_label):
|
| 290 |
+
models = CLIENT_CONFIG['coder_by_provider'].get(provider, [])
|
| 291 |
+
if preferred_label in models:
|
| 292 |
+
return preferred_label
|
| 293 |
+
return models[0] if models else None
|
| 294 |
+
|
| 295 |
+
initial_coder_model_val = get_safe_default(initial_coder_provider, default_model_label)
|
| 296 |
+
initial_strategist_model_val = get_safe_default(initial_strategist_provider, default_model_label)
|
| 297 |
+
|
| 298 |
def load_demo_data():
|
| 299 |
# TASK 2: "Load Demo" Button Model Switch
|
| 300 |
# Switch to a high-end model for the demo
|
| 301 |
+
demo_model_label = "gemini-2.5-pro" # Assumes this key exists or will be handled
|
| 302 |
+
# Fallback if exact label not found, try to find a 'pro' model
|
| 303 |
+
models = CLIENT_CONFIG['coder_by_provider'].get("Google Gemini", [])
|
| 304 |
+
target_model = demo_model_label
|
| 305 |
+
if demo_model_label not in models:
|
| 306 |
+
# Try to find a pro model
|
| 307 |
+
pro_models = [m for m in models if 'pro' in m.lower()]
|
| 308 |
+
if pro_models:
|
| 309 |
+
target_model = pro_models[0]
|
| 310 |
+
elif models:
|
| 311 |
+
target_model = models[0]
|
| 312 |
+
|
| 313 |
+
return DEMO_BLUEPRINT, DEMO_INTENT, gr.update(value=target_model)
|
| 314 |
|
| 315 |
def start_execution_sequence():
|
| 316 |
return gr.update(visible=False), gr.update(visible=True), gr.update(visible=False)
|
|
|
|
| 341 |
coder_models_for_reset = CLIENT_CONFIG['coder_by_provider'].get(initial_coder_provider, [])
|
| 342 |
strategist_models_for_reset = CLIENT_CONFIG['strategist_by_provider'].get(initial_strategist_provider, [])
|
| 343 |
|
| 344 |
+
coder_reset_value = initial_coder_model_val
|
| 345 |
+
strategist_reset_value = initial_strategist_model_val
|
| 346 |
|
| 347 |
return (
|
| 348 |
"", # blueprint_input
|
|
|
|
| 375 |
)
|
| 376 |
coder_model = gr.Dropdown(
|
| 377 |
choices=CLIENT_CONFIG['coder_by_provider'].get(initial_coder_provider, []),
|
| 378 |
+
value=initial_coder_model_val,
|
| 379 |
label="Model",
|
| 380 |
interactive=True
|
| 381 |
)
|
|
|
|
| 424 |
)
|
| 425 |
strategist_model = gr.Dropdown(
|
| 426 |
choices=CLIENT_CONFIG['strategist_by_provider'].get(initial_strategist_provider, []),
|
| 427 |
+
value=initial_strategist_model_val,
|
| 428 |
label="Model",
|
| 429 |
interactive=True
|
| 430 |
)
|