Staticaliza commited on
Commit
e864faa
1 Parent(s): 37ba605

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -27,13 +27,13 @@ for model_name, model_endpoint in API_ENDPOINTS.items():
27
  CHOICES.append(model_name)
28
  CLIENTS[model_name] = InferenceClient(model_endpoint, headers = { "Authorization": f"Bearer {API_TOKEN}" })
29
 
30
- def format(instruction = DEFAULT_INSTRUCTION, history = [], input = "", preoutput = ""):
31
  sy_l, sy_r = SPECIAL_SYMBOLS[0], SPECIAL_SYMBOLS[1]
32
  formatted_history = "".join(f"{sy_l}{message[0]}{sy_r}\n{sy_l}{message[1]}{sy_r}\n" for message in history)
33
  formatted_input = f"{sy_l}System: {instruction}{sy_r}\n{formatted_history}{sy_l}{input}{sy_r}\n{sy_l}{preoutput}"
34
  return formatted_input
35
 
36
- def predict(instruction, history, input, preoutput, access_key, model, temperature, top_p, top_k, rep_p, max_tokens, stop_seqs, seed):
37
 
38
  if (access_key != KEY):
39
  print(">>> MODEL FAILED: Input: " + input + ", Attempted Key: " + access_key)
@@ -68,7 +68,7 @@ def predict(instruction, history, input, preoutput, access_key, model, temperatu
68
 
69
  print(f"---\nUSER: {input}\nBOT: {get_result}\n---")
70
 
71
- return (formatted_input + response, input, history)
72
 
73
  def clear_history():
74
  print(">>> HISTORY CLEARED!")
 
27
  CHOICES.append(model_name)
28
  CLIENTS[model_name] = InferenceClient(model_endpoint, headers = { "Authorization": f"Bearer {API_TOKEN}" })
29
 
30
+ def format(instruction, history, input, preoutput):
31
  sy_l, sy_r = SPECIAL_SYMBOLS[0], SPECIAL_SYMBOLS[1]
32
  formatted_history = "".join(f"{sy_l}{message[0]}{sy_r}\n{sy_l}{message[1]}{sy_r}\n" for message in history)
33
  formatted_input = f"{sy_l}System: {instruction}{sy_r}\n{formatted_history}{sy_l}{input}{sy_r}\n{sy_l}{preoutput}"
34
  return formatted_input
35
 
36
+ def predict(instruction = DEFAULT_INSTRUCTION, history = [], input = "", preoutput = "", access_key, model, temperature, top_p, top_k, rep_p, max_tokens, stop_seqs, seed):
37
 
38
  if (access_key != KEY):
39
  print(">>> MODEL FAILED: Input: " + input + ", Attempted Key: " + access_key)
 
68
 
69
  print(f"---\nUSER: {input}\nBOT: {get_result}\n---")
70
 
71
+ return (preoutput + response, input, history)
72
 
73
  def clear_history():
74
  print(">>> HISTORY CLEARED!")