Ammar2k commited on
Commit
54f84c8
·
1 Parent(s): 538c7bc

Update app.py

Browse files

changing call_transcript to knowledge_base

Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -33,7 +33,7 @@ def load_into_chroma(docs):
33
  db_chroma = Chroma.from_documents(docs, embeddings)
34
 
35
 
36
- def generate_content(query, call_transcript):
37
  # relevant_docs = db_chroma.similarity_search(query)
38
  system_prompt = f"""You are a professional writer of motivational letters.\
39
  You will be given a content from a knowledge base below, delimited by triple \
@@ -42,7 +42,7 @@ motivational letter for graduate school application. Only write content \
42
  using data from the knowledgebase, do not claim facts from outside of it. \
43
  Make the letter very personal with regards to the knowledge base.
44
 
45
- Knowledge Base: ```{call_transcript}```
46
  """
47
  system_message = SystemMessage(content=system_prompt)
48
  human_message = HumanMessage(content=query)
@@ -69,7 +69,7 @@ def main():
69
  st.session_state.messages = [AIMessage(content="How can I help you?")]
70
  if uploaded_file is not None:
71
  # extract text from word file
72
- call_transcript = docx2txt.process(uploaded_file)
73
  # load_into_chroma(call_transcript)
74
 
75
  with st.sidebar:
@@ -78,7 +78,7 @@ def main():
78
 
79
  if st.button("Generate content"):
80
  with st.spinner("GPT is thinking..."):
81
- response = generate_content(user_input, call_transcript)
82
  st.session_state.messages.append(AIMessage(content=response))
83
 
84
  # display message history
 
33
  db_chroma = Chroma.from_documents(docs, embeddings)
34
 
35
 
36
+ def generate_content(query, knowledge_base):
37
  # relevant_docs = db_chroma.similarity_search(query)
38
  system_prompt = f"""You are a professional writer of motivational letters.\
39
  You will be given a content from a knowledge base below, delimited by triple \
 
42
  using data from the knowledgebase, do not claim facts from outside of it. \
43
  Make the letter very personal with regards to the knowledge base.
44
 
45
+ Knowledge Base: ```{knowledge_base}```
46
  """
47
  system_message = SystemMessage(content=system_prompt)
48
  human_message = HumanMessage(content=query)
 
69
  st.session_state.messages = [AIMessage(content="How can I help you?")]
70
  if uploaded_file is not None:
71
  # extract text from word file
72
+ knowledge_base = docx2txt.process(uploaded_file)
73
  # load_into_chroma(call_transcript)
74
 
75
  with st.sidebar:
 
78
 
79
  if st.button("Generate content"):
80
  with st.spinner("GPT is thinking..."):
81
+ response = generate_content(user_input, knowledge_base)
82
  st.session_state.messages.append(AIMessage(content=response))
83
 
84
  # display message history