binqiangliu commited on
Commit
2084a5d
1 Parent(s): fb196bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -78,7 +78,8 @@ def get_conversation_chain(vector_store):
78
  #repo_id="HuggingFaceH4/starchat-beta"
79
  llm = HuggingFaceHub(repo_id=repo_id,
80
  model_kwargs={"min_length":1024,
81
- "max_new_tokens":5632, "do_sample":True,
 
82
  "temperature":0.1,
83
  "top_k":50,
84
  "top_p":0.95, "eos_token_id":49155})
@@ -114,20 +115,23 @@ def main():
114
  if "chat_history" not in st.session_state:
115
  st.session_state.chat_history = None
116
  st.header('Chat with Your own PDFs :books:')
117
- question = st.text_input("Ask anything to your PDF: ")
118
  #if question:
 
 
 
119
  if question !="" and not question.strip().isspace() and not question == "" and not question.strip() == "" and not question.isspace():
120
  handle_user_input(question)
121
- with st.sidebar:
122
- st.subheader("Upload your Documents Here: ")
123
- pdf_files = st.file_uploader("Choose your PDF Files and Press OK", type=['pdf'], accept_multiple_files=True)
124
- if st.button("OK"):
125
- with st.spinner("Preparation under process..."):
126
- # Create Vector Store
127
- vector_store = get_vector_store()
128
- st.write("DONE")
129
- # Create conversation chain
130
- st.session_state.conversation = get_conversation_chain(vector_store)
131
 
132
  if __name__ == '__main__':
133
  main()
 
78
  #repo_id="HuggingFaceH4/starchat-beta"
79
  llm = HuggingFaceHub(repo_id=repo_id,
80
  model_kwargs={"min_length":1024,
81
+ #"max_new_tokens":5632, "do_sample":True,
82
+ "max_new_tokens":3072, "do_sample":True,
83
  "temperature":0.1,
84
  "top_k":50,
85
  "top_p":0.95, "eos_token_id":49155})
 
115
  if "chat_history" not in st.session_state:
116
  st.session_state.chat_history = None
117
  st.header('Chat with Your own PDFs :books:')
118
+
119
  #if question:
120
+ vector_store = get_vector_store()
121
+ st.session_state.conversation = get_conversation_chain(vector_store)
122
+ question = st.text_input("Ask anything to your PDF: ")
123
  if question !="" and not question.strip().isspace() and not question == "" and not question.strip() == "" and not question.isspace():
124
  handle_user_input(question)
125
+ # with st.sidebar:
126
+ # st.subheader("Upload your Documents Here: ")
127
+ # pdf_files = st.file_uploader("Choose your PDF Files and Press OK", type=['pdf'], accept_multiple_files=True)
128
+ # if st.button("OK"):
129
+ # with st.spinner("Preparation under process..."):
130
+ # # Create Vector Store
131
+ # vector_store = get_vector_store()
132
+ # st.write("DONE")
133
+ # # Create conversation chain
134
+ # st.session_state.conversation = get_conversation_chain(vector_store)
135
 
136
  if __name__ == '__main__':
137
  main()