Redmind commited on
Commit
34a9b15
1 Parent(s): c49c1b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -20
app.py CHANGED
@@ -810,23 +810,6 @@ def send_mail_with_history(req: gr.Request,chatbot):
810
  if req.username:
811
  send_email_with_attachment_mailjet("lakshmivairamani@gmail.com","conversation history" + req.username, chatbot)
812
 
813
- # List of sample autocomplete suggestions
814
- autocomplete_suggestions = [
815
- "What is cross docking?",
816
- "Can you create a bar chart with item name and quantity for warehouse WH1000001",
817
- "What is GRN?",
818
- "What are the active warehouses?",
819
- "How can I learn Python?",
820
- "Explain machine learning.",
821
- "What is deep learning?",
822
- "Give me some tips for learning AI."
823
- ]
824
-
825
- # Function to suggest matching text based on user input
826
- def suggest_text(user_input):
827
- # Filter suggestions based on user input
828
- matches = [s for s in autocomplete_suggestions if user_input.lower() in s.lower()]
829
- return matches[:5] # Limit to top 5 suggestions
830
 
831
  # CSS for styling the buttons and other elements
832
  css = """
@@ -912,7 +895,7 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
912
  with gr.Row():
913
  with gr.Column(scale=2):
914
  message = gr.Textbox(show_label=False, container=False, placeholder="Please enter your question")
915
- suggestions_output = gr.HighlightedText() # Display matching suggestions
916
  with gr.Row():
917
  feedback_textbox = gr.Textbox(visible=False, show_label=False, container=False, placeholder="Please enter your feedback.")
918
  submit_feedback_button = gr.Button("Submit Feedback", visible=False,elem_classes="gr-buttonbig")
@@ -924,8 +907,7 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
924
  #gr.ClearButton(message, elem_classes="gr-buttonbig")
925
 
926
  stop_button.click(stop_processing, [chatbot],[chatbot])
927
- # Show suggestions as user types
928
- message.change(suggest_text, inputs=message, outputs=suggestions_output)
929
  button.click(handle_query, [message, chatbot], [chatbot])
930
  message.submit(handle_query, [message, chatbot], [chatbot])
931
  message.submit(lambda x: gr.update(value=""), None, [message], queue=False)
 
810
  if req.username:
811
  send_email_with_attachment_mailjet("lakshmivairamani@gmail.com","conversation history" + req.username, chatbot)
812
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
813
 
814
  # CSS for styling the buttons and other elements
815
  css = """
 
895
  with gr.Row():
896
  with gr.Column(scale=2):
897
  message = gr.Textbox(show_label=False, container=False, placeholder="Please enter your question")
898
+
899
  with gr.Row():
900
  feedback_textbox = gr.Textbox(visible=False, show_label=False, container=False, placeholder="Please enter your feedback.")
901
  submit_feedback_button = gr.Button("Submit Feedback", visible=False,elem_classes="gr-buttonbig")
 
907
  #gr.ClearButton(message, elem_classes="gr-buttonbig")
908
 
909
  stop_button.click(stop_processing, [chatbot],[chatbot])
910
+
 
911
  button.click(handle_query, [message, chatbot], [chatbot])
912
  message.submit(handle_query, [message, chatbot], [chatbot])
913
  message.submit(lambda x: gr.update(value=""), None, [message], queue=False)