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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -13,10 +13,6 @@ 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
- @st.cache_data
20
  def load_embed(path):
21
  embeddings_2 = np.load(path)
22
  return embeddings_2
@@ -24,9 +20,18 @@ def load_embed(path):
24
  model = load_model()
25
  reranker = load_reranker()
26
 
27
- df = load_df('D:/AI_Builder/BookDataFrame.csv')
28
  embeddings_2 = load_embed('D:/AI_Builder/BGE_embeddings_2.npy')
29
 
 
 
 
 
 
 
 
 
 
 
30
  st.header(":books: Book Identifier")
31
 
32
  k = 10
 
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)
18
  return embeddings_2
 
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