ThuyNT03 commited on
Commit
027912c
1 Parent(s): 54aaafa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -108,8 +108,6 @@ def BM25_retrieval(query, seg_question_corpus, top_BM25):
108
  def SimCSE_retrieval(query, SimCSE_set, top_Sim):
109
  from sentence_transformers import CrossEncoder
110
  query = my_pre_processing(query)
111
- # Sim_CSE_model_question = SentenceTransformer('VoVanPhuc/sup-SimCSE-VietNamese-phobert-base')
112
- # Sim_CSE_word_ques_embeddings = torch.load('/content/drive/MyDrive/Study/Năm 3/CS336-IR/model/word_ques_embeddings.pth')
113
  Sim_CSE_model_question = SimCSE_set[0]
114
  Sim_CSE_word_ques_embeddings = SimCSE_set[1]
115
 
@@ -123,8 +121,6 @@ def Para_retriveval(query, para_set, top_para):
123
  query = my_pre_processing(query)
124
  from sentence_transformers import SentenceTransformer, CrossEncoder
125
  import torch
126
- # retri_model = SentenceTransformer('sentence-transformers/paraphrase-multilingual-mpnet-base-v2')
127
- # para_question_embeddings = torch.load('/content/drive/MyDrive/Study/Năm 3/CS336-IR/model/para_embeddings.pth')
128
  retri_model = para_set[0]
129
  para_question_embeddings = para_set[1]
130
 
@@ -198,7 +194,7 @@ def retrieval(query, question_corpus, seg_question_corpus, models, top_n = 15, t
198
 
199
  client = OpenAI(
200
  # defaults to os.environ.get("OPENAI_API_KEY")
201
- api_key= <API_key>,)
202
 
203
  def chat_gpt(prompt):
204
  response = client.chat.completions.create(
@@ -241,7 +237,7 @@ def RAG(query):
241
  answer['reference'] = f"https://dichvucong.gov.vn/p/home/dvc-tthc-thu-tuc-hanh-chinh-chi-tiet.html?ma_thu_tuc={info['ID']}"
242
  return answer
243
 
244
- #print(RAG("tôi muốn biết cách làm biển sổ xe lần lần đầu"))
245
  with gr.Blocks() as demo:
246
  chatbot = gr.Chatbot()
247
  msg = gr.Textbox()
 
108
  def SimCSE_retrieval(query, SimCSE_set, top_Sim):
109
  from sentence_transformers import CrossEncoder
110
  query = my_pre_processing(query)
 
 
111
  Sim_CSE_model_question = SimCSE_set[0]
112
  Sim_CSE_word_ques_embeddings = SimCSE_set[1]
113
 
 
121
  query = my_pre_processing(query)
122
  from sentence_transformers import SentenceTransformer, CrossEncoder
123
  import torch
 
 
124
  retri_model = para_set[0]
125
  para_question_embeddings = para_set[1]
126
 
 
194
 
195
  client = OpenAI(
196
  # defaults to os.environ.get("OPENAI_API_KEY")
197
+ api_key= <API_key>,) # điền API key ở đây
198
 
199
  def chat_gpt(prompt):
200
  response = client.chat.completions.create(
 
237
  answer['reference'] = f"https://dichvucong.gov.vn/p/home/dvc-tthc-thu-tuc-hanh-chinh-chi-tiet.html?ma_thu_tuc={info['ID']}"
238
  return answer
239
 
240
+
241
  with gr.Blocks() as demo:
242
  chatbot = gr.Chatbot()
243
  msg = gr.Textbox()