A-Roucher commited on
Commit
7cb5c6d
1 Parent(s): 5184573

feat: improve description

Browse files
Files changed (2) hide show
  1. .gitignore +1 -0
  2. app.py +3 -4
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ *.faiss
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import streamlit as st
2
  from sentence_transformers import SentenceTransformer
3
  import datasets
4
- import faiss
5
  import time
6
  import faiss
7
 
@@ -9,7 +8,7 @@ import faiss
9
  if "initialized" not in st.session_state:
10
  st.session_state.dataset = datasets.load_dataset('A-Roucher/english_historical_quotes', download_mode="force_redownload")['train']
11
  st.session_state.all_authors = list(set(st.session_state.dataset['author']))
12
- model_name = "BAAI/bge-small-en-v1.5" # "sentence-transformers/all-MiniLM-L6-v2" # # "Cohere/Cohere-embed-english-light-v3.0" # "sentence-transformers/all-MiniLM-L6-v2"
13
  st.session_state.encoder = SentenceTransformer(model_name)
14
  st.session_state.index = faiss.read_index('index_alone.faiss')
15
  st.session_state.initialized=True
@@ -44,10 +43,10 @@ st.markdown(
44
  </style>
45
  """,unsafe_allow_html=True
46
  )
 
47
  col1, col2 = st.columns([8, 2])
48
  text_input = col1.text_input("Type your idea here:", placeholder="Knowledge of history is power.")
49
  submit_button = col2.button("_Search quotes!_")
50
 
51
  if submit_button:
52
- st.markdown(search(text_input))
53
-
 
1
  import streamlit as st
2
  from sentence_transformers import SentenceTransformer
3
  import datasets
 
4
  import time
5
  import faiss
6
 
 
8
  if "initialized" not in st.session_state:
9
  st.session_state.dataset = datasets.load_dataset('A-Roucher/english_historical_quotes', download_mode="force_redownload")['train']
10
  st.session_state.all_authors = list(set(st.session_state.dataset['author']))
11
+ model_name = "BAAI/bge-small-en-v1.5" # "Cohere/Cohere-embed-english-light-v3.0" # "sentence-transformers/all-MiniLM-L6-v2"
12
  st.session_state.encoder = SentenceTransformer(model_name)
13
  st.session_state.index = faiss.read_index('index_alone.faiss')
14
  st.session_state.initialized=True
 
43
  </style>
44
  """,unsafe_allow_html=True
45
  )
46
+ st.markdown("# 🏛 Quotes 🪶\n\n_Great mind thinks alike_: who had the same ideas as you?\n\nType your idea below, and find similar thoughts from famous historical figures.")
47
  col1, col2 = st.columns([8, 2])
48
  text_input = col1.text_input("Type your idea here:", placeholder="Knowledge of history is power.")
49
  submit_button = col2.button("_Search quotes!_")
50
 
51
  if submit_button:
52
+ st.markdown(search(text_input))