Staticaliza commited on
Commit
d762b96
1 Parent(s): 04320ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -37,7 +37,7 @@ def predict(instruction, history, input, preoutput, access_key, model, temperatu
37
 
38
  if (access_key != KEY):
39
  print(">>> MODEL FAILED: Input: " + input + ", Attempted Key: " + access_key)
40
- return ("[UNAUTHORIZED ACCESS]", input);
41
 
42
  instruction = instruction or DEFAULT_INSTRUCTION
43
  history = history or []
@@ -67,13 +67,14 @@ def predict(instruction, history, input, preoutput, access_key, model, temperatu
67
  pre_result = f"{sy_l}{response}{sy_r}{''.join(SPECIAL_SYMBOLS)}"
68
  pattern = re.compile(f"{sy_l}(.*?){sy_r}", re.DOTALL)
69
  match = pattern.search(pre_result)
70
- get_result = match.group(1).strip() if match else ""
71
 
72
  history = history + [[input, get_result]]
73
-
 
74
  print(f"---\nUSER: {input}\nBOT: {get_result}\n---")
75
 
76
- return (preoutput + response, input, history)
77
 
78
  def clear_history():
79
  print(">>> HISTORY CLEARED!")
 
37
 
38
  if (access_key != KEY):
39
  print(">>> MODEL FAILED: Input: " + input + ", Attempted Key: " + access_key)
40
+ return ("[UNAUTHORIZED ACCESS]", input, []);
41
 
42
  instruction = instruction or DEFAULT_INSTRUCTION
43
  history = history or []
 
67
  pre_result = f"{sy_l}{response}{sy_r}{''.join(SPECIAL_SYMBOLS)}"
68
  pattern = re.compile(f"{sy_l}(.*?){sy_r}", re.DOTALL)
69
  match = pattern.search(pre_result)
70
+ get_result = preoutput + match.group(1).strip() if match else ""
71
 
72
  history = history + [[input, get_result]]
73
+
74
+ print(formatted_input + get_result)
75
  print(f"---\nUSER: {input}\nBOT: {get_result}\n---")
76
 
77
+ return (get_result, input, history)
78
 
79
  def clear_history():
80
  print(">>> HISTORY CLEARED!")