david-meltzer commited on
Commit
4cd2aa6
·
1 Parent(s): 76c5257

fixed selftext

Browse files
Files changed (1) hide show
  1. app.py +17 -13
app.py CHANGED
@@ -15,16 +15,6 @@ 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"):
20
- # """Instantiate a sentence-level DistilBERT model."""
21
- # return AutoModel.from_pretrained(f'sentence-transformers/{name}')
22
- #
23
- #@st.cache(allow_output_mutation=True)
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."""
@@ -83,11 +73,25 @@ def main():
83
  # continue
84
 
85
  st.write(
86
- f"""**{f['title']}**
87
- **text**: {f['selftext']}
88
- """
89
  )
 
 
 
 
 
90
 
91
 
92
  if __name__ == "__main__":
93
  main()
 
 
 
 
 
 
 
 
 
 
 
 
15
  """Read the data from huggingface."""
16
  return load_dataset(dataset_repo)['validation_asks']
17
 
 
 
 
 
 
 
 
 
 
 
18
  @st.cache_data
19
  def load_faiss_index(path_to_faiss="./faiss_index_small.pickle"):
20
  """Load and deserialize the Faiss index."""
 
73
  # continue
74
 
75
  st.write(
76
+ f"""**title**: {f['title']}"""
 
 
77
  )
78
+ if f['selftext']!='':
79
+ st.write(
80
+ f"""**text**: {f['selftext']}"""
81
+ )
82
+
83
 
84
 
85
  if __name__ == "__main__":
86
  main()
87
+
88
+ #@st.cache(allow_output_mutation=True)
89
+ #def load_bert_model(name="nli-distilbert-base"):
90
+ # """Instantiate a sentence-level DistilBERT model."""
91
+ # return AutoModel.from_pretrained(f'sentence-transformers/{name}')
92
+ #
93
+ #@st.cache(allow_output_mutation=True)
94
+ #def load_tokenizer(name="nli-distilbert-base"):
95
+ # return AutoTokenizer.from_pretrained(f'sentence-transformers/{name}')
96
+
97
+ #@st.cache(allow_output_mutation=True)