mainakhf commited on
Commit
b402914
·
verified ·
1 Parent(s): 4abc04d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -6,7 +6,7 @@ from langchain.chains.question_answering import load_qa_chain
6
  from langchain.chains import load_chain
7
  from langchain.llms import OpenAI
8
  import streamlit as st
9
- import pyautogui
10
  import os, shutil
11
 
12
  def delete_directory(directory_path):
@@ -77,7 +77,7 @@ if os.path.exists("faiss_index"):
77
  for message in st.session_state.messages:
78
  with st.chat_message(message["role"]):
79
  st.markdown(message["content"])
80
- if prompt := st.chat_input("What is up? Type 'exit' for leave the chat"):
81
  # Display user message in chat message container
82
  with st.chat_message("user"):
83
  st.markdown(prompt)
@@ -89,9 +89,9 @@ if os.path.exists("faiss_index"):
89
  chain = load_qa_chain(OpenAI(), chain_type="stuff")
90
  if prompt is None:
91
  re='Ask me anything about the pdf'
92
- elif prompt=='exit':
93
- delete_directory('faiss_index')
94
- pyautogui.hotkey('f5') #Simulates F5 key press = page refresh
95
  else:
96
  with st.spinner('Typping...'):
97
  re=return_response(str(prompt),document_search,chain)
 
6
  from langchain.chains import load_chain
7
  from langchain.llms import OpenAI
8
  import streamlit as st
9
+ # import pyautogui
10
  import os, shutil
11
 
12
  def delete_directory(directory_path):
 
77
  for message in st.session_state.messages:
78
  with st.chat_message(message["role"]):
79
  st.markdown(message["content"])
80
+ if prompt := st.chat_input("What is up?"):
81
  # Display user message in chat message container
82
  with st.chat_message("user"):
83
  st.markdown(prompt)
 
89
  chain = load_qa_chain(OpenAI(), chain_type="stuff")
90
  if prompt is None:
91
  re='Ask me anything about the pdf'
92
+ # elif prompt=='exit':
93
+ # delete_directory('faiss_index')
94
+ # pyautogui.hotkey('f5') #Simulates F5 key press = page refresh
95
  else:
96
  with st.spinner('Typping...'):
97
  re=return_response(str(prompt),document_search,chain)