Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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)
|