Luigi commited on
Commit
c9dbd58
Β·
1 Parent(s): 56057a0

fix: remove legacy model info panels and initialize unified panel with default model

Browse files

- Remove Model Information section from Preset Models tab
- Remove Custom Model Info section from Custom GGUF tab
- Initialize model_info_output with default model specs on page load
- Update custom model load handlers to populate unified panel instead of removed panels
- Simplify update_settings_on_model_change to only return inference parameters
- Ensure unified Model Information panel shows specs immediately on page load
- Clean up duplicate model information displays across the interface

Files changed (1) hide show
  1. app.py +8 -21
app.py CHANGED
@@ -2643,14 +2643,6 @@ def create_interface():
2643
  interactive=True,
2644
  visible=AVAILABLE_MODELS[DEFAULT_MODEL_KEY].get("supports_toggle", False)
2645
  )
2646
-
2647
- # Model info for preset models
2648
- gr.HTML('<div class="section-header" style="margin-top: 12px;"><span class="section-icon">πŸ“Š</span> Model Information</div>')
2649
- _default_threads = DEFAULT_CUSTOM_THREADS if DEFAULT_CUSTOM_THREADS > 0 else 2
2650
- preset_model_info = gr.Markdown(
2651
- value=get_model_info(DEFAULT_MODEL_KEY, n_threads=_default_threads)[0],
2652
- elem_classes=["stats-grid"]
2653
- )
2654
 
2655
  # --- Tab 2: Custom GGUF ---
2656
  with gr.TabItem("πŸ”§ Custom GGUF"):
@@ -2684,13 +2676,6 @@ def create_interface():
2684
  )
2685
 
2686
  retry_btn = gr.Button("πŸ”„ Retry", variant="secondary", visible=False)
2687
-
2688
- # Model info for custom models (shows after loading)
2689
- gr.HTML('<div class="section-header" style="margin-top: 12px;"><span class="section-icon">πŸ“Š</span> Custom Model Info</div>')
2690
- custom_info_output = gr.Markdown(
2691
- value="*Load a model to see its specifications...*",
2692
- elem_classes=["stats-grid"]
2693
- )
2694
 
2695
  # Hardware Configuration (Standard Mode)
2696
  gr.HTML('<div class="section-header" style="margin-top: 16px;"><span class="section-icon">πŸ–₯️</span> Hardware Configuration</div>')
@@ -2949,8 +2934,10 @@ def create_interface():
2949
  # Model Information (shows selected model specs)
2950
  with gr.Group():
2951
  gr.HTML('<div class="section-header"><span class="section-icon">πŸ“Š</span> Model Information</div>')
 
 
2952
  model_info_output = gr.Markdown(
2953
- value="*Select a mode and model to see specifications...*",
2954
  elem_classes=["info-box"]
2955
  )
2956
 
@@ -2992,7 +2979,7 @@ def create_interface():
2992
 
2993
  # Function to update settings when model changes
2994
  def update_settings_on_model_change(model_key, thread_config, custom_threads, custom_metadata=None):
2995
- """Update all Advanced Settings when model selection changes."""
2996
  # Calculate n_threads based on preset
2997
  thread_preset_map = {
2998
  "free": 2,
@@ -3003,7 +2990,7 @@ def create_interface():
3003
 
3004
  info_text, temp_str, top_p_val, top_k_val = get_model_info(model_key, n_threads=n_threads, custom_metadata=custom_metadata)
3005
  temperature = float(temp_str) if temp_str else 0.6
3006
- return temperature, top_p_val, top_k_val, info_text
3007
 
3008
  # Event handlers
3009
  # Note: submit_btn.click is registered below (after custom model loader section)
@@ -3013,7 +3000,7 @@ def create_interface():
3013
  model_dropdown.change(
3014
  fn=update_settings_on_model_change,
3015
  inputs=[model_dropdown, thread_config_dropdown, custom_threads_slider, custom_model_metadata],
3016
- outputs=[temperature_slider, top_p, top_k, preset_model_info]
3017
  )
3018
 
3019
  # Update reasoning checkbox when model changes
@@ -3391,7 +3378,7 @@ def create_interface():
3391
  ).then(
3392
  fn=lambda metadata, thread_config, custom_threads: get_model_info("custom_hf", n_threads=get_thread_count(thread_config, custom_threads), custom_metadata=metadata)[0],
3393
  inputs=[custom_model_metadata, thread_config_dropdown, custom_threads_slider],
3394
- outputs=[custom_info_output],
3395
  )
3396
 
3397
  # Retry button - same as load
@@ -3402,7 +3389,7 @@ def create_interface():
3402
  ).then(
3403
  fn=lambda metadata, thread_config, custom_threads: get_model_info("custom_hf", n_threads=get_thread_count(thread_config, custom_threads), custom_metadata=metadata)[0],
3404
  inputs=[custom_model_metadata, thread_config_dropdown, custom_threads_slider],
3405
- outputs=[custom_info_output],
3406
  )
3407
 
3408
  # ===== SUBMIT BUTTON ROUTER =====
 
2643
  interactive=True,
2644
  visible=AVAILABLE_MODELS[DEFAULT_MODEL_KEY].get("supports_toggle", False)
2645
  )
 
 
 
 
 
 
 
 
2646
 
2647
  # --- Tab 2: Custom GGUF ---
2648
  with gr.TabItem("πŸ”§ Custom GGUF"):
 
2676
  )
2677
 
2678
  retry_btn = gr.Button("πŸ”„ Retry", variant="secondary", visible=False)
 
 
 
 
 
 
 
2679
 
2680
  # Hardware Configuration (Standard Mode)
2681
  gr.HTML('<div class="section-header" style="margin-top: 16px;"><span class="section-icon">πŸ–₯️</span> Hardware Configuration</div>')
 
2934
  # Model Information (shows selected model specs)
2935
  with gr.Group():
2936
  gr.HTML('<div class="section-header"><span class="section-icon">πŸ“Š</span> Model Information</div>')
2937
+ _default_threads = DEFAULT_CUSTOM_THREADS if DEFAULT_CUSTOM_THREADS > 0 else 2
2938
+ _default_info = get_model_info(DEFAULT_MODEL_KEY, n_threads=_default_threads)[0]
2939
  model_info_output = gr.Markdown(
2940
+ value=_default_info,
2941
  elem_classes=["info-box"]
2942
  )
2943
 
 
2979
 
2980
  # Function to update settings when model changes
2981
  def update_settings_on_model_change(model_key, thread_config, custom_threads, custom_metadata=None):
2982
+ """Update inference settings when model selection changes."""
2983
  # Calculate n_threads based on preset
2984
  thread_preset_map = {
2985
  "free": 2,
 
2990
 
2991
  info_text, temp_str, top_p_val, top_k_val = get_model_info(model_key, n_threads=n_threads, custom_metadata=custom_metadata)
2992
  temperature = float(temp_str) if temp_str else 0.6
2993
+ return temperature, top_p_val, top_k_val
2994
 
2995
  # Event handlers
2996
  # Note: submit_btn.click is registered below (after custom model loader section)
 
3000
  model_dropdown.change(
3001
  fn=update_settings_on_model_change,
3002
  inputs=[model_dropdown, thread_config_dropdown, custom_threads_slider, custom_model_metadata],
3003
+ outputs=[temperature_slider, top_p, top_k]
3004
  )
3005
 
3006
  # Update reasoning checkbox when model changes
 
3378
  ).then(
3379
  fn=lambda metadata, thread_config, custom_threads: get_model_info("custom_hf", n_threads=get_thread_count(thread_config, custom_threads), custom_metadata=metadata)[0],
3380
  inputs=[custom_model_metadata, thread_config_dropdown, custom_threads_slider],
3381
+ outputs=[model_info_output],
3382
  )
3383
 
3384
  # Retry button - same as load
 
3389
  ).then(
3390
  fn=lambda metadata, thread_config, custom_threads: get_model_info("custom_hf", n_threads=get_thread_count(thread_config, custom_threads), custom_metadata=metadata)[0],
3391
  inputs=[custom_model_metadata, thread_config_dropdown, custom_threads_slider],
3392
+ outputs=[model_info_output],
3393
  )
3394
 
3395
  # ===== SUBMIT BUTTON ROUTER =====