JPBianchi commited on
Commit
97f211e
1 Parent(s): bde43a7

fixed app too

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -229,7 +229,10 @@ def get_weaviate_client(api_key, url, model_name_or_path, openai_api_key):
229
  model_name_or_path=model_name_or_path,
230
  openai_api_key=openai_api_key)
231
  client.display_properties.append('summary')
232
- available_classes = sorted(client.show_classes())
 
 
 
233
  # st.write(f"Available classes: {available_classes}")
234
  # st.write(f"Available classes type: {type(available_classes)}")
235
  logger.info(available_classes)
@@ -324,6 +327,8 @@ def main():
324
  check_model(model_name_or_path)
325
  try:
326
  client, available_classes = get_weaviate_client(Wapi_key, url, model_name_or_path, openai_api_key)
 
 
327
  except Exception as e:
328
  # Weaviate doesn't know this model, maybe we're just finetuning a model
329
  st.sidebar.write(f"Model unknown to Weaviate")
@@ -334,8 +339,8 @@ def main():
334
  class_name = st.selectbox(
335
  label='Class Name:',
336
  options=available_classes,
337
- index=available_classes.index(start_class),
338
- placeholder='Select Class Name'
339
  )
340
 
341
  st.write("----------")
@@ -368,7 +373,6 @@ def main():
368
  st.text(f"Hybrid MRR: {vector_mrr}")
369
  st.text(f"Total misses: {total_misses}")
370
 
371
-
372
  st.write("----------")
373
 
374
  st.title("Chat with the Impact Theory podcasts!")
 
229
  model_name_or_path=model_name_or_path,
230
  openai_api_key=openai_api_key)
231
  client.display_properties.append('summary')
232
+ # available_classes = sorted(client.show_classes()) # doesn't work anymore
233
+ # print(available_classes)
234
+ available_classes = sorted([c['class'] for c in client.schema.get()['classes']])
235
+ # print(available_classes)
236
  # st.write(f"Available classes: {available_classes}")
237
  # st.write(f"Available classes type: {type(available_classes)}")
238
  logger.info(available_classes)
 
327
  check_model(model_name_or_path)
328
  try:
329
  client, available_classes = get_weaviate_client(Wapi_key, url, model_name_or_path, openai_api_key)
330
+ print(available_classes)
331
+
332
  except Exception as e:
333
  # Weaviate doesn't know this model, maybe we're just finetuning a model
334
  st.sidebar.write(f"Model unknown to Weaviate")
 
339
  class_name = st.selectbox(
340
  label='Class Name:',
341
  options=available_classes,
342
+ index=available_classes.index(start_class),
343
+ placeholder='Select Class Name'
344
  )
345
 
346
  st.write("----------")
 
373
  st.text(f"Hybrid MRR: {vector_mrr}")
374
  st.text(f"Total misses: {total_misses}")
375
 
 
376
  st.write("----------")
377
 
378
  st.title("Chat with the Impact Theory podcasts!")