cstr commited on
Commit
ce55771
Β·
verified Β·
1 Parent(s): c6a926f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -12
app.py CHANGED
@@ -106,6 +106,10 @@ MODEL_CONTEXT_SIZES = {
106
  "c4ai-aya-expanse-32b": 131072,
107
  },
108
  "GLHF API": {
 
 
 
 
109
  "mistralai/Mistral-7B-Instruct-v0.3": 32768,
110
  "microsoft/phi-3-mini-4k-instruct": 4096,
111
  "microsoft/Phi-3.5-mini-instruct": 4096,
@@ -522,14 +526,14 @@ def send_to_model_impl(prompt, model_selection, hf_model_choice, hf_custom_model
522
  if not glhf_api_key:
523
  return "Error: GLHF API key required", None
524
 
525
- # Determine the actual model ID to use
526
- if glhf_model == "Use HuggingFace Model":
527
- model_id = f"hf:{hf_custom_model if hf_model_choice == 'Custom Model' else model_registry.hf_models[hf_model_choice]}"
528
- else:
529
  model_id = f"hf:{glhf_custom_model}"
 
 
530
 
531
  summary = send_to_glhf(prompt, glhf_api_key, model_id, use_rate_limits)
532
-
533
  else:
534
  return "Error: Invalid model selection", None
535
 
@@ -956,9 +960,9 @@ with gr.Blocks(css="""
956
  label="πŸ”‘ GLHF API Key",
957
  type="password"
958
  )
959
- glhf_model = gr.Radio(
960
- choices=["Use HuggingFace Model", "Custom Model"],
961
- value="Use HuggingFace Model",
962
  label="Model Selection"
963
  )
964
  glhf_custom_model = gr.Textbox(
@@ -1122,18 +1126,17 @@ with gr.Blocks(css="""
1122
  ]
1123
  elif choice == "GLHF API":
1124
  # Always show HuggingFace models for GLHF since they're used in both cases
1125
- model_choices = list(model_registry.hf_models.keys())
1126
  return [
1127
- gr.update(visible=True), # hf_options - Keep visible for model selection
1128
  gr.update(visible=False), # groq_options
1129
  gr.update(visible=False), # openai_options
1130
  gr.update(visible=False), # cohere_options
1131
  gr.update(visible=True), # glhf_options
1132
  gr.update(value=ctx_size), # context_size
1133
- gr.Dropdown(choices=model_choices, value="Mixtral 7B") # Use HF models
1134
  ]
1135
 
1136
-
1137
  # Default return for "Clipboard only" or other options
1138
  return [
1139
  gr.update(visible=False), # hf_options
 
106
  "c4ai-aya-expanse-32b": 131072,
107
  },
108
  "GLHF API": {
109
+ "mistralai/Mixtral-8x7B-Instruct-v0.1": 32768,
110
+ "mistralai/Mixtral-8x7B-Instruct-v0.2": 32768,
111
+ "NousResearch/Nous-Hermes-2-Solar-10.7B": 32768,
112
+ "01-ai/Yi-34B-Chat": 32768,
113
  "mistralai/Mistral-7B-Instruct-v0.3": 32768,
114
  "microsoft/phi-3-mini-4k-instruct": 4096,
115
  "microsoft/Phi-3.5-mini-instruct": 4096,
 
526
  if not glhf_api_key:
527
  return "Error: GLHF API key required", None
528
 
529
+ # Handle model selection
530
+ if glhf_model == "Custom Model":
 
 
531
  model_id = f"hf:{glhf_custom_model}"
532
+ else:
533
+ model_id = f"hf:{glhf_model}"
534
 
535
  summary = send_to_glhf(prompt, glhf_api_key, model_id, use_rate_limits)
536
+
537
  else:
538
  return "Error: Invalid model selection", None
539
 
 
960
  label="πŸ”‘ GLHF API Key",
961
  type="password"
962
  )
963
+ glhf_model = gr.Dropdown(
964
+ choices=list(MODEL_CONTEXT_SIZES["GLHF API"].keys()) + ["Custom Model"],
965
+ value="mistralai/Mistral-7B-Instruct-v0.3",
966
  label="Model Selection"
967
  )
968
  glhf_custom_model = gr.Textbox(
 
1126
  ]
1127
  elif choice == "GLHF API":
1128
  # Always show HuggingFace models for GLHF since they're used in both cases
1129
+ # model_choices = list(model_registry.hf_models.keys())
1130
  return [
1131
+ gr.update(visible=False), # hf_options - hide completely
1132
  gr.update(visible=False), # groq_options
1133
  gr.update(visible=False), # openai_options
1134
  gr.update(visible=False), # cohere_options
1135
  gr.update(visible=True), # glhf_options
1136
  gr.update(value=ctx_size), # context_size
1137
+ gr.Dropdown(choices=[]) # not used
1138
  ]
1139
 
 
1140
  # Default return for "Clipboard only" or other options
1141
  return [
1142
  gr.update(visible=False), # hf_options