Tuana commited on
Commit
8ab7d9a
β€’
1 Parent(s): 4e2b533

attempting to add a sidebar

Browse files
pages/πŸ’β€β™€οΈ_Info.py CHANGED
@@ -1,4 +1,7 @@
1
  import streamlit as st
 
 
 
2
 
3
  st.markdown("""
4
  # Better Image Retrieval With Reinforced CLIP 🧠
 
1
  import streamlit as st
2
+ from utils.frontend import build_sidebar
3
+
4
+ build_sidebar()
5
 
6
  st.markdown("""
7
  # Better Image Retrieval With Reinforced CLIP 🧠
utils/frontend.py CHANGED
@@ -1,5 +1,12 @@
1
  import streamlit as st
2
 
 
 
 
 
 
 
 
3
  def set_state_if_absent(key, value):
4
  if key not in st.session_state:
5
  st.session_state[key] = value
 
1
  import streamlit as st
2
 
3
+ def build_sidebar():
4
+ sidebar = """
5
+ <p><br/><a href='https://github.com/TuanaCelik/find-the-animal'>Github project</a> - Based on <a href='https://github.com/deepset-ai/haystack'>Haystack</a></p>
6
+ </div>
7
+ """
8
+ st.sidebar.markdown(sidebar, unsafe_allow_html=True)
9
+
10
  def set_state_if_absent(key, value):
11
  if key not in st.session_state:
12
  st.session_state[key] = value
utils/haystack.py CHANGED
@@ -40,6 +40,7 @@ def start_haystack():
40
  faiss_index_path=f"{INDEX_DIR}/images.faiss",
41
  faiss_config_path=f"{INDEX_DIR}/images.json",
42
  )
 
43
  retriever_text = EmbeddingRetriever(
44
  document_store=document_store_text,
45
  embedding_model="sentence-transformers/multi-qa-mpnet-base-dot-v1",
 
40
  faiss_index_path=f"{INDEX_DIR}/images.faiss",
41
  faiss_config_path=f"{INDEX_DIR}/images.json",
42
  )
43
+
44
  retriever_text = EmbeddingRetriever(
45
  document_store=document_store_text,
46
  embedding_model="sentence-transformers/multi-qa-mpnet-base-dot-v1",
🏑_Home.py CHANGED
@@ -6,7 +6,7 @@ from PIL import Image
6
  from markdown import markdown
7
  from annotated_text import annotation
8
  from utils.haystack import query
9
- from utils.frontend import reset_results, set_state_if_absent
10
 
11
  def create_answer_objects(predictions):
12
  results = []
@@ -32,6 +32,7 @@ def create_answer_objects(predictions):
32
  return results
33
 
34
  def main():
 
35
 
36
  set_state_if_absent("statement", "What is the fastest animal?")
37
  set_state_if_absent("results", None)
 
6
  from markdown import markdown
7
  from annotated_text import annotation
8
  from utils.haystack import query
9
+ from utils.frontend import reset_results, set_state_if_absent, build_sidebar
10
 
11
  def create_answer_objects(predictions):
12
  results = []
 
32
  return results
33
 
34
  def main():
35
+ build_sidebar()
36
 
37
  set_state_if_absent("statement", "What is the fastest animal?")
38
  set_state_if_absent("results", None)