Rabbit-Innotech commited on
Commit
60e4bd5
Β·
verified Β·
1 Parent(s): d419702

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -47
app.py CHANGED
@@ -778,9 +778,7 @@ def clean_body_content(html_content):
778
 
779
 
780
  if __name__ == "__main__":
781
- website = ["https://www.rra.gov.rw/en/publications",
782
- "https://www.rra.gov.rw/en/customs-services",
783
-
784
 
785
  ]
786
  all_content = scrape_websites(website)
@@ -815,7 +813,7 @@ for text in processed_texts:
815
 
816
 
817
  vectorstore = Chroma(
818
- collection_name="R_R_A",
819
  embedding_function=embed_model,
820
  persist_directory="./",
821
  )
@@ -825,24 +823,6 @@ vectorstore.get().keys()
825
  vectorstore.add_texts(chunked_texts)
826
 
827
 
828
- # template = ("""
829
- # You are a friendly and intelligent chatbot designed to assist users in a conversational and human-like manner. Your goal is to provide accurate, helpful, and engaging responses from the provided context: {context} while maintaining a natural tone. Follow these guidelines:
830
-
831
- # 1. **Greetings:** If the user greets you (e.g., "Morning," "Hello," "Hi"), respond warmly and acknowledge the greeting. For example:
832
- # - "😊 Good morning! How can I assist you today?"
833
- # - "Hello! What can I do for you? πŸš€"
834
- # 2. **Extract Information:** If the user asks for specific information, extract only the relevant details from the provided context: {context}.
835
- # 3. **Human-like Interaction:** Respond in a warm, conversational tone. Use emojis occasionally to make the interaction more engaging (e.g., 😊, πŸš€).
836
- # 4. **Stay Updated:** Acknowledge the current date and time to show you are aware of real-time updates.
837
- # 5. **No Extra Content:** If no information matches the user's request, respond politely: "I don't have that information at the moment, but I'm happy to help with something else! 😊"
838
- # 6. **Personalized Interaction:** Use the user's historical interactions (if available) to tailor your responses and make the conversation more personalized.
839
- # 7. **Direct Data Only:** If the user requests specific data, provide only the requested information without additional explanations unless asked.
840
-
841
- # Context: {context}
842
- # User's Question: {question}
843
- # Your Response:
844
- # """)
845
-
846
  template = ("""
847
  You are a friendly, intelligent, and conversational AI assistant designed to provide accurate, engaging, and human-like responses based on the given context. Your goal is to extract relevant details from the provided context: {context} and assist the user effectively. Follow these guidelines:
848
 
@@ -909,14 +889,7 @@ def rag_memory_stream(message, history):
909
  yield partial_text
910
 
911
  # Title with emojis
912
- title = "RRA Chatbot"
913
-
914
- # Short description for the examples section
915
- examples = [
916
- " Can you help me with the tax rates on vehicle importation?",
917
- " What is TIN deregistration? What about Tax account deactivation?",
918
- "When do I receive my registration certificate?"
919
- ]
920
 
921
 
922
  # Custom CSS for styling the interface
@@ -940,29 +913,12 @@ body {
940
  outline: none; /* Remove outline focus for a cleaner look */
941
  }
942
 
943
- /* Custom CSS for the examples section */
944
- .gr-examples {
945
- font-size: 30px; /* Increase font size of examples */
946
- background-color: #f9f9f9; /* Light background color */
947
- border-radius: 30px; /* Rounded corners */
948
- }
949
-
950
- .gr-examples .example {
951
- background-color: white; /* White background for each example */
952
- cursor: pointer; /* Change cursor to pointer on hover */
953
- transition: background-color 0.3s ease; /* Smooth hover effect */
954
- }
955
-
956
- .gr-examples .example:hover {
957
- background-color: #f1f1f1; /* Light gray background on hover */
958
- }
959
  """
960
 
961
  # Create the Chat Interface
962
  demo = gr.ChatInterface(
963
  fn=rag_memory_stream,
964
  title=title,
965
- examples=examples, # Display the short description and example questions
966
  fill_height=True,
967
  theme="soft",
968
  css=custom_css, # Apply the custom CSS
 
778
 
779
 
780
  if __name__ == "__main__":
781
+ website = ["https://haguruka.org.rw/"
 
 
782
 
783
  ]
784
  all_content = scrape_websites(website)
 
813
 
814
 
815
  vectorstore = Chroma(
816
+ collection_name="GBVR_Dataset",
817
  embedding_function=embed_model,
818
  persist_directory="./",
819
  )
 
823
  vectorstore.add_texts(chunked_texts)
824
 
825
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
826
  template = ("""
827
  You are a friendly, intelligent, and conversational AI assistant designed to provide accurate, engaging, and human-like responses based on the given context. Your goal is to extract relevant details from the provided context: {context} and assist the user effectively. Follow these guidelines:
828
 
 
889
  yield partial_text
890
 
891
  # Title with emojis
892
+ title = "GBVR Chatbot"
 
 
 
 
 
 
 
893
 
894
 
895
  # Custom CSS for styling the interface
 
913
  outline: none; /* Remove outline focus for a cleaner look */
914
  }
915
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
916
  """
917
 
918
  # Create the Chat Interface
919
  demo = gr.ChatInterface(
920
  fn=rag_memory_stream,
921
  title=title,
 
922
  fill_height=True,
923
  theme="soft",
924
  css=custom_css, # Apply the custom CSS