dx2102 commited on
Commit
fb41ae4
·
verified ·
1 Parent(s): 36bdd2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -119,6 +119,11 @@ with gr.Blocks() as demo:
119
  @spaces.GPU
120
  def bot_fn(history: list):
121
  prefix = history[-1]["content"]
 
 
 
 
 
122
  history.append({"role": "assistant", "content": ""})
123
  history[-1]["content"] += "Generating with the given prefix...\n"
124
  queue = Queue(maxsize=10)
 
119
  @spaces.GPU
120
  def bot_fn(history: list):
121
  prefix = history[-1]["content"]
122
+ # prevent the model from continuing user's score title
123
+ if prefix != '' and '\n' not in prefix:
124
+ # prefix is a single line --> prefix is the score title
125
+ prefix += '\n'
126
+
127
  history.append({"role": "assistant", "content": ""})
128
  history[-1]["content"] += "Generating with the given prefix...\n"
129
  queue = Queue(maxsize=10)