FredZhang7 commited on
Commit
bdbdff6
1 Parent(s): ce7a346

move regex

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -14,13 +14,6 @@ pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
14
 
15
  def generate_prompt(instruction, input=None, history=None):
16
  has_history = (history is not None)
17
- if has_history:
18
- input = "\""
19
- for pair in history:
20
- if len(pair[0]) > 0 and len(pair[1]) > 0:
21
- input += f"User: {pair[0]}\nAssistant: {pair[1]}\n"
22
- input = input[:-1] + "\"\n" + f"User: {instruction}"
23
- instruction = "Based on the Conversation History, generate a Response for the User."
24
  if instruction:
25
  instruction = (
26
  instruction.strip()
@@ -28,6 +21,13 @@ def generate_prompt(instruction, input=None, history=None):
28
  .replace("\n\n", "\n")
29
  .replace("\n\n", "\n")
30
  )
 
 
 
 
 
 
 
31
  if input and len(input) > 0:
32
  input = (
33
  input.strip()
@@ -51,7 +51,7 @@ examples = [
51
  [
52
  "Écrivez un programme Python pour miner 1 Bitcoin, avec des commentaires.",
53
  "",
54
- 300,
55
  1.2,
56
  0.5,
57
  0.5,
@@ -62,7 +62,7 @@ examples = [
62
  [
63
  "Write a story using the following information",
64
  "A man named Alex chops a tree down",
65
- 300,
66
  1.2,
67
  0.5,
68
  0.5,
@@ -71,7 +71,7 @@ examples = [
71
  [
72
  "Generate a list of adjectives that describe a person as brave.",
73
  "",
74
- 300,
75
  1.2,
76
  0.5,
77
  0.5,
@@ -80,7 +80,7 @@ examples = [
80
  [
81
  "You have $100, and your goal is to turn that into as much money as possible with AI and Machine Learning. Please respond with detailed plan.",
82
  "",
83
- 300,
84
  1.2,
85
  0.5,
86
  0.5,
 
14
 
15
  def generate_prompt(instruction, input=None, history=None):
16
  has_history = (history is not None)
 
 
 
 
 
 
 
17
  if instruction:
18
  instruction = (
19
  instruction.strip()
 
21
  .replace("\n\n", "\n")
22
  .replace("\n\n", "\n")
23
  )
24
+ if has_history:
25
+ input = "\""
26
+ for pair in history:
27
+ if len(pair[0]) > 0 and len(pair[1]) > 0:
28
+ input += f"User: {pair[0]}\nAssistant: {pair[1]}\n"
29
+ input = input[:-1] + "\"\n" + f"User: {instruction}"
30
+ instruction = "Based on the Conversation History, generate a Response for the User."
31
  if input and len(input) > 0:
32
  input = (
33
  input.strip()
 
51
  [
52
  "Écrivez un programme Python pour miner 1 Bitcoin, avec des commentaires.",
53
  "",
54
+ 333,
55
  1.2,
56
  0.5,
57
  0.5,
 
62
  [
63
  "Write a story using the following information",
64
  "A man named Alex chops a tree down",
65
+ 333,
66
  1.2,
67
  0.5,
68
  0.5,
 
71
  [
72
  "Generate a list of adjectives that describe a person as brave.",
73
  "",
74
+ 333,
75
  1.2,
76
  0.5,
77
  0.5,
 
80
  [
81
  "You have $100, and your goal is to turn that into as much money as possible with AI and Machine Learning. Please respond with detailed plan.",
82
  "",
83
+ 333,
84
  1.2,
85
  0.5,
86
  0.5,