uyen13 commited on
Commit
7dd9465
β€’
1 Parent(s): f912256

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -6,10 +6,10 @@ from langchain.embeddings import HuggingFaceEmbeddings
6
  from langchain.vectorstores import FAISS
7
  from langchain.llms import CTransformers
8
  from langchain.chains import ConversationalRetrievalChain
 
9
  from ctransformers import AutoModelForCausalLM
10
  from langchain_g4f import G4FLLM
11
  from g4f import Provider, models
12
- # import spacy
13
  import requests
14
  # Define the path for generated embeddings
15
  DB_FAISS_PATH = 'vectorstore/db_faiss'
@@ -50,7 +50,7 @@ hide_streamlit_style = """
50
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
51
 
52
  # Set the title for the Streamlit app
53
- st.title("Zendo美ε₯³γƒγƒ£γƒƒγƒˆγƒœγƒƒγ‚―γ‚Ή")
54
 
55
  csv_url = "https://huggingface.co/spaces/uyen13/chatgirl/raw/main/testchatdata.csv"
56
  # csv_url="https://docs.google.com/uc?export=download&id=1fQ2v2n9zQcoi6JoOU3lCBDHRt3a1PmaE"
@@ -83,8 +83,6 @@ llm = load_llm()
83
 
84
  # Create a conversational chain
85
  chain = ConversationalRetrievalChain.from_llm(llm=llm, retriever=db.as_retriever())
86
- # Initialize spaCy with the Japanese model
87
- # nlp = spacy.load("ja_core_news_sm")
88
 
89
  # Function for conversational chat
90
  def conversational_chat(query):
@@ -98,9 +96,10 @@ if 'history' not in st.session_state:
98
 
99
  # Initialize messages
100
  if 'generated' not in st.session_state:
101
- st.session_state['generated'] = ["こんにけは!zendo美ε₯³γ§γ™γ€‚δ½•γ‹γŠζŽ’γ—γ§γ™γ‹οΌŸ... πŸ€—"]
 
102
  if 'past' not in st.session_state:
103
- st.session_state['past'] = ["γƒγƒ£γƒƒγƒˆγ―γ“γ“γ‹γ‚‰"]
104
 
105
  # Create containers for chat history and user input
106
  response_container = st.container()
@@ -109,7 +108,7 @@ container = st.container()
109
  # User input form
110
  with container:
111
  with st.form(key='my_form', clear_on_submit=True):
112
- user_input = st.text_input("ChatBox", placeholder="θ³ͺε•γ‚’γ”θ¨˜ε…₯ください... ", key='input')
113
  submit_button = st.form_submit_button(label='Send')
114
 
115
  if submit_button and user_input:
@@ -123,5 +122,3 @@ if st.session_state['generated']:
123
  for i in range(len(st.session_state['generated'])):
124
  message(st.session_state["past"][i], is_user=True, key=str(i) + '_user', avatar_style="big-smile")
125
  message(st.session_state["generated"][i], key=str(i), avatar_style="thumbs")
126
-
127
-
 
6
  from langchain.vectorstores import FAISS
7
  from langchain.llms import CTransformers
8
  from langchain.chains import ConversationalRetrievalChain
9
+ from dl_hf_model import dl_hf_model
10
  from ctransformers import AutoModelForCausalLM
11
  from langchain_g4f import G4FLLM
12
  from g4f import Provider, models
 
13
  import requests
14
  # Define the path for generated embeddings
15
  DB_FAISS_PATH = 'vectorstore/db_faiss'
 
50
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
51
 
52
  # Set the title for the Streamlit app
53
+ st.title("Coloring Anime ChatBot")
54
 
55
  csv_url = "https://huggingface.co/spaces/uyen13/chatgirl/raw/main/testchatdata.csv"
56
  # csv_url="https://docs.google.com/uc?export=download&id=1fQ2v2n9zQcoi6JoOU3lCBDHRt3a1PmaE"
 
83
 
84
  # Create a conversational chain
85
  chain = ConversationalRetrievalChain.from_llm(llm=llm, retriever=db.as_retriever())
 
 
86
 
87
  # Function for conversational chat
88
  def conversational_chat(query):
 
96
 
97
  # Initialize messages
98
  if 'generated' not in st.session_state:
99
+ st.session_state['generated'] = ["Hello ! Ask me about this page like coloring book,how to buy ... πŸ€—"]
100
+
101
  if 'past' not in st.session_state:
102
+ st.session_state['past'] = ["your chat here"]
103
 
104
  # Create containers for chat history and user input
105
  response_container = st.container()
 
108
  # User input form
109
  with container:
110
  with st.form(key='my_form', clear_on_submit=True):
111
+ user_input = st.text_input("ChatBox", placeholder="Ask anything... ", key='input')
112
  submit_button = st.form_submit_button(label='Send')
113
 
114
  if submit_button and user_input:
 
122
  for i in range(len(st.session_state['generated'])):
123
  message(st.session_state["past"][i], is_user=True, key=str(i) + '_user', avatar_style="big-smile")
124
  message(st.session_state["generated"][i], key=str(i), avatar_style="thumbs")