mmargg commited on
Commit
95cdd07
·
verified ·
1 Parent(s): 8570615

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -27,7 +27,7 @@ with open("financial_aid.txt", "r", encoding="utf-8") as file:
27
  acadenic_tips_text = file.read()
28
 
29
  # Print the text below
30
- print(poverty_and_education)
31
 
32
  # ===== APPLY THE COMPLETE WORKFLOW =====
33
 
@@ -117,16 +117,16 @@ def get_top_chunks(query, chunk_embeddings, text_chunks):
117
 
118
  # Print the top results
119
  #print(top_results)
120
- cleaned_chunks = preprocess_text(poverty_and_education)
121
  chunk_embeddings = create_embeddings(cleaned_chunks)
122
  #AI API being used
123
- client= InferenceClient("Qwen/Qwen2.5-7B-Instruct-1M")
124
  response=""
125
  #defining role of AI and user
126
 
127
  def respond(message,history):
128
  information = get_top_chunks(message, chunk_embeddings, cleaned_chunks)
129
- messages = [{"role": "assistant", "content": f"You are a friendly chatbot that gives advice to disadvantaged students about their education based on their question. When you give advice, keep in mind the following infromation {information}"}]
130
 
131
 
132
  if history:
@@ -140,7 +140,7 @@ def respond(message,history):
140
 
141
  ### STEP 6
142
  # Call the preprocess_text function and store the result in a cleaned_chunks variable
143
- cleaned_chunks = preprocess_text(poverty_and_education) # Complete this line
144
  top_results = get_top_chunks("How does poverty affect one's education?", chunk_embeddings, cleaned_chunks) # Complete this line
145
 
146
  print(top_results)
 
27
  acadenic_tips_text = file.read()
28
 
29
  # Print the text below
30
+ print(academic_tips_text)
31
 
32
  # ===== APPLY THE COMPLETE WORKFLOW =====
33
 
 
117
 
118
  # Print the top results
119
  #print(top_results)
120
+ cleaned_chunks = preprocess_text(academic_tips_text)
121
  chunk_embeddings = create_embeddings(cleaned_chunks)
122
  #AI API being used
123
+ client= InferenceClient("all-MiniLM-L6-v2")
124
  response=""
125
  #defining role of AI and user
126
 
127
  def respond(message,history):
128
  information = get_top_chunks(message, chunk_embeddings, cleaned_chunks)
129
+ messages = [{"role": "assistant", "content": f"You are a friendly, helpful chatbot that gives academic advice to disadvantaged students about their education based on their question. When you give advice, keep in mind the following infromation {information}"}]
130
 
131
 
132
  if history:
 
140
 
141
  ### STEP 6
142
  # Call the preprocess_text function and store the result in a cleaned_chunks variable
143
+ cleaned_chunks = preprocess_text(academic_tips_text) # Complete this line
144
  top_results = get_top_chunks("How does poverty affect one's education?", chunk_embeddings, cleaned_chunks) # Complete this line
145
 
146
  print(top_results)