nestole commited on
Commit
3e9f047
·
verified ·
1 Parent(s): 91bfd0f

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +5 -10
run.py CHANGED
@@ -43,7 +43,6 @@ key30 = os.getenv("key30")
43
  key31 = os.getenv("key31")
44
 
45
  pkey="-----BEGIN PRIVATE KEY-----\n"+key2+"\n"+key3+"\n"+ key4+"\n"+key5+"\n"+ key6+"\n"+key7+"\n"+key8+"\n"+key9+"\n"+key10+"\n"+key11+"\n"+key12+"\n"+key13+"\n"+key14+"\n"+key15+"\n"+key16+"\n"+key17+"\n"+key18+"\n"+key19+"\n"+key20+"\n"+key21+"\n"+key22+"\n"+key24+"\n"+key25+"\n"+key26+"\n"+key27+"\n"+key28+"\n-----END PRIVATE KEY-----\n"
46
- print(pkey)
47
  json_data={
48
  "type": "service_account",
49
  "project_id": "nestolechatbot",
@@ -194,15 +193,11 @@ def extract_ip_and_device(headers_obj):
194
  return ip_address, device_info
195
 
196
  def format_prompt(message, history):
197
- print("HISTORY")
198
- print(history)
199
  prompt = ""
200
  if history:
201
  user_prompt, bot_response = history[-1]
202
  prompt += f"[INST] {user_prompt} [/INST] {bot_response}</s> "
203
- prompt += f"[INST] {message} [/INST]"
204
- print("Final P")
205
- print(prompt)
206
  return prompt
207
 
208
  def format_promptc(message):
@@ -211,7 +206,7 @@ def format_promptc(message):
211
  return prompt
212
 
213
  def responsecritical(
214
- prompt, temperature=0.9, max_new_tokens=200, top_p=0.95, repetition_penalty=1.0,
215
  ):
216
  temperature = float(temperature)
217
  if temperature < 1e-2: temperature = 1e-2
@@ -235,10 +230,10 @@ def responsecritical(
235
  sentence_lower = outputc.lower()
236
  print("Done critcial")
237
  # Check if the word 'nein' is in the sentence
238
- if 'nein' in sentence_lower:
239
- return True
240
- else:
241
  return False
 
 
242
 
243
 
244
  def response(
 
43
  key31 = os.getenv("key31")
44
 
45
  pkey="-----BEGIN PRIVATE KEY-----\n"+key2+"\n"+key3+"\n"+ key4+"\n"+key5+"\n"+ key6+"\n"+key7+"\n"+key8+"\n"+key9+"\n"+key10+"\n"+key11+"\n"+key12+"\n"+key13+"\n"+key14+"\n"+key15+"\n"+key16+"\n"+key17+"\n"+key18+"\n"+key19+"\n"+key20+"\n"+key21+"\n"+key22+"\n"+key24+"\n"+key25+"\n"+key26+"\n"+key27+"\n"+key28+"\n-----END PRIVATE KEY-----\n"
 
46
  json_data={
47
  "type": "service_account",
48
  "project_id": "nestolechatbot",
 
193
  return ip_address, device_info
194
 
195
  def format_prompt(message, history):
 
 
196
  prompt = ""
197
  if history:
198
  user_prompt, bot_response = history[-1]
199
  prompt += f"[INST] {user_prompt} [/INST] {bot_response}</s> "
200
+ prompt += f"[INST] {message} [/INST]"
 
 
201
  return prompt
202
 
203
  def format_promptc(message):
 
206
  return prompt
207
 
208
  def responsecritical(
209
+ prompt, temperature=0.9, max_new_tokens=10, top_p=0.95, repetition_penalty=1.0,
210
  ):
211
  temperature = float(temperature)
212
  if temperature < 1e-2: temperature = 1e-2
 
230
  sentence_lower = outputc.lower()
231
  print("Done critcial")
232
  # Check if the word 'nein' is in the sentence
233
+ if 'ja' in sentence_lower:
 
 
234
  return False
235
+ else:
236
+ return True
237
 
238
 
239
  def response(