Nymbo commited on
Commit
7a4f867
·
verified ·
1 Parent(s): 45b016b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -59,7 +59,7 @@ def respond(
59
  print("Latest user message appended.")
60
 
61
  # Determine which model to use
62
- # If custom_model is provided, use it; otherwise use the selected model from radio
63
  model_to_use = custom_model.strip() if custom_model.strip() != "" else selected_model
64
  print(f"Model selected for inference: {model_to_use}")
65
 
@@ -235,11 +235,11 @@ def filter_models(search_term):
235
 
236
  def set_custom_model_from_radio(selected):
237
  """
238
- This function is no longer used, but kept for reference.
239
- Previously it would update the Custom Model textbox with the selected model.
240
  """
241
  print(f"Featured model selected: {selected}")
242
- return selected
243
 
244
  # Create the Gradio interface
245
  demo = gr.ChatInterface(
@@ -271,13 +271,13 @@ with demo:
271
  )
272
  print("Model search box change event linked.")
273
 
274
- # Remove this connection so the custom model box doesn't get filled automatically
275
- # featured_model_radio.change(
276
- # fn=set_custom_model_from_radio,
277
- # inputs=featured_model_radio,
278
- # outputs=custom_model_box
279
- # )
280
- # print("Featured model radio button change event linked.")
281
 
282
  print("Gradio interface initialized.")
283
 
 
59
  print("Latest user message appended.")
60
 
61
  # Determine which model to use
62
+ # Only use custom_model if it's not empty and was manually entered by user
63
  model_to_use = custom_model.strip() if custom_model.strip() != "" else selected_model
64
  print(f"Model selected for inference: {model_to_use}")
65
 
 
235
 
236
  def set_custom_model_from_radio(selected):
237
  """
238
+ Function is disabled - now just returns empty string to prevent auto-filling
239
+ Custom Model field when selecting from the radio buttons
240
  """
241
  print(f"Featured model selected: {selected}")
242
+ return "" # Return empty string instead of the selected model
243
 
244
  # Create the Gradio interface
245
  demo = gr.ChatInterface(
 
271
  )
272
  print("Model search box change event linked.")
273
 
274
+ # Connect the featured model radio to update the custom model box
275
+ featured_model_radio.change(
276
+ fn=set_custom_model_from_radio,
277
+ inputs=featured_model_radio,
278
+ outputs=custom_model_box
279
+ )
280
+ print("Featured model radio button change event linked.")
281
 
282
  print("Gradio interface initialized.")
283