chatbytes commited on
Commit
c9ce280
·
verified ·
1 Parent(s): a70f058

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -6,11 +6,11 @@ from langchain_community.vectorstores import FAISS
6
  from langchain.chains import RetrievalQA
7
  from secret1 import GOOGLE_API as google_api
8
  import PyPDF2
9
- # def chatbot_response(user_input, history):
10
- # # This is a placeholder function. Replace with your actual chatbot logic.
11
- # bot_response = "You said: " + user_input
12
- # history.append((user_input, bot_response))
13
- # return history, history
14
 
15
  def text_splitter_function(text):
16
  text_splitter = CharacterTextSplitter(
@@ -63,7 +63,8 @@ with gr.Blocks() as demo:
63
  input_file=gr.File(label="Upload PDF", file_count="single")
64
  submit_btn=gr.Button("Submit")
65
  # submit_btn.click(text_extract, [input_file], [user_input])
66
- send_btn.click("chatbot_response",[user_input,state],[chatbot, state])
 
67
 
68
  if __name__ == "__main__":
69
  embeddings=GooglePalmEmbeddings(google_api_key=google_api)
 
6
  from langchain.chains import RetrievalQA
7
  from secret1 import GOOGLE_API as google_api
8
  import PyPDF2
9
+ def chatbot_response(user_input, history):
10
+ # This is a placeholder function. Replace with your actual chatbot logic.
11
+ bot_response = "You said: " + user_input
12
+ history.append((user_input, bot_response))
13
+ return history, history
14
 
15
  def text_splitter_function(text):
16
  text_splitter = CharacterTextSplitter(
 
63
  input_file=gr.File(label="Upload PDF", file_count="single")
64
  submit_btn=gr.Button("Submit")
65
  # submit_btn.click(text_extract, [input_file], [user_input])
66
+ submit_btn.click()
67
+ send_btn.click(chatbot_response,input=[user_input,state],output="[chatbot, state]")
68
 
69
  if __name__ == "__main__":
70
  embeddings=GooglePalmEmbeddings(google_api_key=google_api)