yangtb24 commited on
Commit
6711564
1 Parent(s): 66e8528

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -6
app.py CHANGED
@@ -101,9 +101,15 @@ def refresh_models():
101
  """
102
  global text_models, free_text_models
103
  global embedding_models, free_embedding_models
104
-
105
- text_models = get_all_models(FREE_MODEL_TEST_KEY, "chat")
106
- embedding_models = get_all_models(FREE_MODEL_TEST_KEY, "embedding") + get_all_models(FREE_MODEL_TEST_KEY, "reranker")
 
 
 
 
 
 
107
  free_text_models = []
108
  free_embedding_models = []
109
 
@@ -117,7 +123,9 @@ def refresh_models():
117
  model
118
  ): model for model in text_models
119
  }
120
- for future in concurrent.futures.as_completed(future_to_model):
 
 
121
  model = future_to_model[future]
122
  try:
123
  is_free = future.result()
@@ -131,12 +139,14 @@ def refresh_models():
131
  ) as executor:
132
  future_to_model = {
133
  executor.submit(
134
- test_model_availability,
135
  FREE_MODEL_TEST_KEY,
136
  model
137
  ): model for model in embedding_models
138
  }
139
- for future in concurrent.futures.as_completed(future_to_model):
 
 
140
  model = future_to_model[future]
141
  try:
142
  is_free = future.result()
 
101
  """
102
  global text_models, free_text_models
103
  global embedding_models, free_embedding_models
104
+
105
+ text_models = get_all_models(
106
+ FREE_MODEL_TEST_KEY,
107
+ "chat"
108
+ )
109
+ embedding_models = get_all_models(
110
+ FREE_MODEL_TEST_KEY,
111
+ "embedding"
112
+ ) + get_all_models(FREE_MODEL_TEST_KEY, "reranker")
113
  free_text_models = []
114
  free_embedding_models = []
115
 
 
123
  model
124
  ): model for model in text_models
125
  }
126
+ for future in concurrent.futures.as_completed(
127
+ future_to_model
128
+ ):
129
  model = future_to_model[future]
130
  try:
131
  is_free = future.result()
 
139
  ) as executor:
140
  future_to_model = {
141
  executor.submit(
142
+ test_embedding_model_availability,
143
  FREE_MODEL_TEST_KEY,
144
  model
145
  ): model for model in embedding_models
146
  }
147
+ for future in concurrent.futures.as_completed(
148
+ future_to_model
149
+ ):
150
  model = future_to_model[future]
151
  try:
152
  is_free = future.result()