yurasolokha commited on
Commit
3401f97
·
verified ·
1 Parent(s): 33cfafc

Updated clear_chat_history function

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -13,6 +13,12 @@ aws_secret_key = os.getenv('AWS_SECRET_ACCESS_KEY')
13
  region = os.getenv('AWS_REGION')
14
  initial_message = os.getenv('INITIAL_MESSAGE')
15
 
 
 
 
 
 
 
16
  # "amazon.titan-text-express-v1"
17
  # "amazon.titan-text-premier-v1:0"
18
  amazon_model_id = "amazon.titan-text-premier-v1:0"
@@ -199,7 +205,12 @@ def respond(message, chat_history, temperature=0.9, top_p=0.6, max_token_count=5
199
  )
200
 
201
  def clear_chat_history():
202
- return '', [], '', gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
 
 
 
 
 
203
 
204
  def main():
205
  with gr.Blocks(css="""
@@ -210,9 +221,9 @@ def main():
210
  chatbot = gr.Chatbot([[None, initial_message]], height=600)
211
 
212
  with gr.Row():
213
- suggestion1 = gr.Button("How to edit RFID crew badge?", elem_classes="suggestion-button", visible=True)
214
- suggestion2 = gr.Button("What types of RFID tags exist?", elem_classes="suggestion-button", visible=True)
215
- suggestion3 = gr.Button("Is it possible to delete a facility?", elem_classes="suggestion-button", visible=True)
216
 
217
  msg = gr.Textbox(label="Question")
218
 
 
13
  region = os.getenv('AWS_REGION')
14
  initial_message = os.getenv('INITIAL_MESSAGE')
15
 
16
+ initial_suggestions = [
17
+ "How to edit RFID crew badge?",
18
+ "What types of RFID tags exist?",
19
+ "Is it possible to delete a facility?"
20
+ ]
21
+
22
  # "amazon.titan-text-express-v1"
23
  # "amazon.titan-text-premier-v1:0"
24
  amazon_model_id = "amazon.titan-text-premier-v1:0"
 
205
  )
206
 
207
  def clear_chat_history():
208
+ return (
209
+ '', [[None, initial_message]], '',
210
+ gr.update(visible=True, value=initial_suggestions[0]),
211
+ gr.update(visible=True, value=initial_suggestions[1]),
212
+ gr.update(visible=True, value=initial_suggestions[2]),
213
+ )
214
 
215
  def main():
216
  with gr.Blocks(css="""
 
221
  chatbot = gr.Chatbot([[None, initial_message]], height=600)
222
 
223
  with gr.Row():
224
+ suggestion1 = gr.Button(initial_suggestions[0], elem_classes="suggestion-button", visible=True)
225
+ suggestion2 = gr.Button(initial_suggestions[1], elem_classes="suggestion-button", visible=True)
226
+ suggestion3 = gr.Button(initial_suggestions[2], elem_classes="suggestion-button", visible=True)
227
 
228
  msg = gr.Textbox(label="Question")
229