Luigi commited on
Commit
82bdb78
·
1 Parent(s): 98badf8

feat: Auto-populate Advanced Settings from model config (Option A)

Browse files

- Added update_settings_on_model_change() function
- Uses existing get_model_info() to fetch model-specific settings
- Temperature, Top P, and Top K sliders now update when model changes
- Model info display also updates dynamically
- Settings now consistent between UI and actual generation

Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -1063,6 +1063,13 @@ def create_interface():
1063
  # File output component for download
1064
  download_output = gr.File(label="Download JSON", visible=True)
1065
 
 
 
 
 
 
 
 
1066
  # Event handlers
1067
  submit_btn.click(
1068
  fn=summarize_streaming,
@@ -1071,6 +1078,13 @@ def create_interface():
1071
  show_progress="full"
1072
  )
1073
 
 
 
 
 
 
 
 
1074
  # Copy buttons
1075
  copy_summary_btn.click(
1076
  fn=lambda x: x,
 
1063
  # File output component for download
1064
  download_output = gr.File(label="Download JSON", visible=True)
1065
 
1066
+ # Function to update settings when model changes
1067
+ def update_settings_on_model_change(model_key):
1068
+ """Update all Advanced Settings when model selection changes."""
1069
+ info_text, temp_str, top_p_val, top_k_val = get_model_info(model_key)
1070
+ temperature = float(temp_str) if temp_str else 0.6
1071
+ return temperature, top_p_val, top_k_val, info_text
1072
+
1073
  # Event handlers
1074
  submit_btn.click(
1075
  fn=summarize_streaming,
 
1078
  show_progress="full"
1079
  )
1080
 
1081
+ # Update settings when model changes
1082
+ model_dropdown.change(
1083
+ fn=update_settings_on_model_change,
1084
+ inputs=[model_dropdown],
1085
+ outputs=[temperature_slider, top_p, top_k, info_output]
1086
+ )
1087
+
1088
  # Copy buttons
1089
  copy_summary_btn.click(
1090
  fn=lambda x: x,