david-meltzer commited on
Commit
85aba76
·
1 Parent(s): d40f2bc

fixed split

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -9,10 +9,11 @@ from transformers import AutoModel, AutoTokenizer
9
 
10
  from datasets import load_dataset
11
 
12
- @st.cache
 
13
  def read_data(dataset_repo='dhmeltzer/asks_validation_embedded'):
14
  """Read the data from huggingface."""
15
- return load_dataset(dataset_repo)
16
 
17
  #@st.cache(allow_output_mutation=True)
18
  #def load_bert_model(name="nli-distilbert-base"):
@@ -23,7 +24,8 @@ def read_data(dataset_repo='dhmeltzer/asks_validation_embedded'):
23
  #def load_tokenizer(name="nli-distilbert-base"):
24
  # return AutoTokenizer.from_pretrained(f'sentence-transformers/{name}')
25
 
26
- @st.cache(allow_output_mutation=True)
 
27
  def load_faiss_index(path_to_faiss="./faiss_index_small.pickle"):
28
  """Load and deserialize the Faiss index."""
29
  with open(path_to_faiss, "rb") as h:
@@ -37,8 +39,6 @@ def main():
37
  #tok = load_tokenizer()
38
  faiss_index = load_faiss_index()
39
 
40
- import requests
41
-
42
  model_id="sentence-transformers/nli-distilbert-base"
43
 
44
  api_url = f"https://api-inference.huggingface.co/pipeline/feature-extraction/{model_id}"
 
9
 
10
  from datasets import load_dataset
11
 
12
+ #@st.cache
13
+ @st.cache_data
14
  def read_data(dataset_repo='dhmeltzer/asks_validation_embedded'):
15
  """Read the data from huggingface."""
16
+ return load_dataset(dataset_repo)['validation_asks']
17
 
18
  #@st.cache(allow_output_mutation=True)
19
  #def load_bert_model(name="nli-distilbert-base"):
 
24
  #def load_tokenizer(name="nli-distilbert-base"):
25
  # return AutoTokenizer.from_pretrained(f'sentence-transformers/{name}')
26
 
27
+ #@st.cache(allow_output_mutation=True)
28
+ @st.cache_data
29
  def load_faiss_index(path_to_faiss="./faiss_index_small.pickle"):
30
  """Load and deserialize the Faiss index."""
31
  with open(path_to_faiss, "rb") as h:
 
39
  #tok = load_tokenizer()
40
  faiss_index = load_faiss_index()
41
 
 
 
42
  model_id="sentence-transformers/nli-distilbert-base"
43
 
44
  api_url = f"https://api-inference.huggingface.co/pipeline/feature-extraction/{model_id}"