migrate to latest myscale

#2
by mpsk - opened
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -42,8 +42,11 @@ def init_db():
42
  meta_field: Meta field that records if an image is viewed
43
  client: Database connection object
44
  """
45
- client = Client(
46
- url=st.secrets["DB_URL"], user=st.secrets["USER"], password=st.secrets["PASSWD"])
 
 
 
47
  # We can check if the connection is alive
48
  assert client.is_alive()
49
  meta_field = {}
@@ -126,7 +129,7 @@ def esm_search(model, sequnce, batch_converter,top_k=5):
126
  client = Client(
127
  url=st.secrets["DB_URL"], user=st.secrets["USER"], password=st.secrets["PASSWD"])
128
 
129
- result = client.fetch("SELECT seq, distance('topK=500')(representations, " + str(token_list) + ')'+ "as dist FROM default.esm_protein_indexer_768")
130
 
131
  result_temp_seq = []
132
 
 
42
  meta_field: Meta field that records if an image is viewed
43
  client: Database connection object
44
  """
45
+ r = parse("{http_pre}://{host}:{port}", st.secrets["DB_URL"])
46
+ client = get_client(
47
+ host=r['host'], port=r['port'], user=st.secrets["USER"], password=st.secrets["PASSWD"],
48
+ interface=r['http_pre'],
49
+ )
50
  # We can check if the connection is alive
51
  assert client.is_alive()
52
  meta_field = {}
 
129
  client = Client(
130
  url=st.secrets["DB_URL"], user=st.secrets["USER"], password=st.secrets["PASSWD"])
131
 
132
+ result = client.fetch("SELECT seq, distance(representations, " + str(token_list) + ')'+ "as dist FROM default.esm_protein_indexer_768 ORDER BY dist LIMIT 500")
133
 
134
  result_temp_seq = []
135