Tuana commited on
Commit
56d29f4
β€’
2 Parent(s): b707cdc 0bdfeea

Merge branch 'main' into requesting-openai-key

Browse files

# Conflicts:
# app.py
# logo/haystack-logo-colored.png
# utils/ui.py

Files changed (4) hide show
  1. app.py +2 -3
  2. logo/haystack-logo-colored.png +0 -0
  3. utils/haystack.py +1 -1
  4. utils/ui.py +16 -7
app.py CHANGED
@@ -7,16 +7,15 @@ import requests
7
 
8
  import streamlit as st
9
 
10
- from utils.haystack import start_haystack, query
11
  from utils.ui import reset_results, set_initial_state, sidebar
12
  from utils.config import TWITTER_BEARER
13
 
14
  set_initial_state()
15
 
16
- st.write("# 🐀 What have they been tweeting about lately?")
17
-
18
  sidebar()
19
 
 
20
 
21
  if st.session_state.get("OPENAI_API_KEY"):
22
  prompter, template = start_haystack(st.session_state.get("OPENAI_API_KEY"))
 
7
 
8
  import streamlit as st
9
 
10
+ from utils.haystack import query, start_haystack
11
  from utils.ui import reset_results, set_initial_state, sidebar
12
  from utils.config import TWITTER_BEARER
13
 
14
  set_initial_state()
15
 
 
 
16
  sidebar()
17
 
18
+ st.write("# 🐀 What have they been tweeting about lately?")
19
 
20
  if st.session_state.get("OPENAI_API_KEY"):
21
  prompter, template = start_haystack(st.session_state.get("OPENAI_API_KEY"))
logo/haystack-logo-colored.png CHANGED
utils/haystack.py CHANGED
@@ -56,5 +56,5 @@ def query(username, prompter, template):
56
  result = prompter.prompt(prompt_template=template, tweets=twitter_stream)
57
  except Exception as e:
58
  print(e)
59
- result = ["Please make sure you are providing a correct, public twitter accout"]
60
  return result
 
56
  result = prompter.prompt(prompt_template=template, tweets=twitter_stream)
57
  except Exception as e:
58
  print(e)
59
+ result = ["Please make sure you are providing a correct, public twitter account"]
60
  return result
utils/ui.py CHANGED
@@ -19,7 +19,11 @@ def set_openai_api_key(api_key: str):
19
  def sidebar():
20
  with st.sidebar:
21
  image = Image.open('logo/haystack-logo-colored.png')
22
- st.image(image, width=250)
 
 
 
 
23
 
24
  st.markdown(
25
  "## How to use\n"
@@ -27,6 +31,7 @@ def sidebar():
27
  "2. Enter a Twitter username in the searchbar\n"
28
  "3. Enjoy πŸ€—\n"
29
  )
 
30
  api_key_input = st.text_input(
31
  "OpenAI API Key",
32
  type="password",
@@ -39,12 +44,16 @@ def sidebar():
39
  set_openai_api_key(api_key_input)
40
 
41
  st.markdown("---")
42
- st.markdown("### About\n"
43
- "This app was built with [Haystack](https://haystack.deepset.ai) using the"
44
- " [PromptNode](https://docs.haystack.deepset.ai/docs/prompt_node) and custom [PromptTemplate](https://docs.haystack.deepset.ai/docs/prompt_node#templates)."
45
- " The source code is also on [GitHub](https://github.com/TuanaCelik/should-i-follow)"
46
- " with instructions to run locally.")
 
 
 
47
  st.markdown("Made by [tuanacelik](https://twitter.com/tuanacelik)")
48
  st.markdown("---")
49
  st.markdown("""Thanks to [mmz_001](https://twitter.com/mm_sasmitha)
50
- for open sourcing [KnowledgeGPT](https://knowledgegpt.streamlit.app/) which helped me with this sidebar πŸ™πŸ½""")
 
 
19
  def sidebar():
20
  with st.sidebar:
21
  image = Image.open('logo/haystack-logo-colored.png')
22
+ st.markdown("Thanks for coming to this πŸ€— Spcae.\n\n"
23
+ "This is a project for fun, and is not a final product."
24
+ "There's a lot that can be improved to make this app better.\n\n"
25
+ "**Take results with a grain of** πŸ§‚\n\n"
26
+ "For more on how this was built, instructions to run locally and to contribute: [visit GitHub](https://github.com/TuanaCelik/should-i-follow#readme)")
27
 
28
  st.markdown(
29
  "## How to use\n"
 
31
  "2. Enter a Twitter username in the searchbar\n"
32
  "3. Enjoy πŸ€—\n"
33
  )
34
+
35
  api_key_input = st.text_input(
36
  "OpenAI API Key",
37
  type="password",
 
44
  set_openai_api_key(api_key_input)
45
 
46
  st.markdown("---")
47
+ st.markdown(
48
+ "## How this works\n"
49
+ "This app was built with [Haystack](https://haystack.deepset.ai) using the"
50
+ " [`PromptNode`](https://docs.haystack.deepset.ai/docs/prompt_node) and custom [`PromptTemplate`](https://docs.haystack.deepset.ai/docs/prompt_node#templates).\n\n"
51
+ " The source code is also on [GitHub](https://github.com/TuanaCelik/should-i-follow)"
52
+ " with instructions to run locally.\n"
53
+ "You can see how the `PromptNode` was set up [here](https://github.com/TuanaCelik/should-i-follow/blob/main/utils/haystack.py)")
54
+ st.markdown("---")
55
  st.markdown("Made by [tuanacelik](https://twitter.com/tuanacelik)")
56
  st.markdown("---")
57
  st.markdown("""Thanks to [mmz_001](https://twitter.com/mm_sasmitha)
58
+ for open sourcing [KnowledgeGPT](https://knowledgegpt.streamlit.app/) which helped me with this sidebar πŸ™πŸ½""")
59
+ st.image(image, width=250)