TheJimmy commited on
Commit
ccf093c
·
verified ·
1 Parent(s): a78a479

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -12,6 +12,11 @@ def load_model():
12
  def load_reranker():
13
  return FlagReranker('BAAI/bge-reranker-v2-m3', use_fp16=True)
14
 
 
 
 
 
 
15
  @st.cache_data
16
  def load_embed(path):
17
  embeddings_2 = np.load(path)
@@ -20,18 +25,9 @@ def load_embed(path):
20
  model = load_model()
21
  reranker = load_reranker()
22
 
 
23
  embeddings_2 = load_embed('D:/AI_Builder/BGE_embeddings_2.npy')
24
 
25
- data = pd.DataFrame(pd.read_csv('D:/AI_Builder/ActualProject/DataCollection/TESTUNCLEANbookquestions.csv'))
26
- data2 = pd.DataFrame(pd.read_csv('D:/AI_Builder/ActualProject/DataCollection/TRAINbookquestions.csv'))
27
- data3 = pd.read_csv("D:/AI_Builder/ActualProject/DataCollection/booksummaries.txt",
28
- header=None,sep="\t",
29
- names=["ID", "Freebase ID", "Book Name", "Book Author", "Pub date", "Genres", "Summary"])
30
- df = pd.concat([data, data2])
31
- df = df.merge(data3, on='ID', how='left')
32
- df = df.rename(columns={'Book Name_x': 'Book Name'})
33
- df = df[['ID', 'Book Name', 'Book Author', 'Questions', 'Summary']]
34
-
35
  st.header(":books: Book Identifier")
36
 
37
  k = 10
 
12
  def load_reranker():
13
  return FlagReranker('BAAI/bge-reranker-v2-m3', use_fp16=True)
14
 
15
+ @st.cache_data
16
+ def load_df(path):
17
+ df = pd.read_csv(path)
18
+ return df
19
+
20
  @st.cache_data
21
  def load_embed(path):
22
  embeddings_2 = np.load(path)
 
25
  model = load_model()
26
  reranker = load_reranker()
27
 
28
+ df = load_df('D:/AI_Builder/BookDataFrame.csv')
29
  embeddings_2 = load_embed('D:/AI_Builder/BGE_embeddings_2.npy')
30
 
 
 
 
 
 
 
 
 
 
 
31
  st.header(":books: Book Identifier")
32
 
33
  k = 10