Update app.py
Browse files
app.py
CHANGED
|
@@ -19,25 +19,23 @@ def respond(
|
|
| 19 |
top_p,
|
| 20 |
):
|
| 21 |
messages = [{"role": "system", "content": system_message}]
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
if val[0]:
|
| 25 |
-
messages.append({"role": "user", "content": val[0]})
|
| 26 |
-
if val[1]:
|
| 27 |
-
messages.append({"role": "assistant", "content": val[1]})
|
| 28 |
|
| 29 |
-
|
| 30 |
|
| 31 |
-
response
|
| 32 |
-
|
| 33 |
-
response = p(messages,
|
| 34 |
max_new_tokens=20,
|
| 35 |
do_sample=True,
|
| 36 |
temperature=1,
|
| 37 |
)
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
| 40 |
|
|
|
|
| 41 |
|
| 42 |
"""
|
| 43 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
|
|
|
| 19 |
top_p,
|
| 20 |
):
|
| 21 |
messages = [{"role": "system", "content": system_message}]
|
| 22 |
+
message = f"<s> {system_message} [INST] {message} [/INST]"
|
| 23 |
|
| 24 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
final = ""
|
| 27 |
|
| 28 |
+
for response in p(message,
|
|
|
|
|
|
|
| 29 |
max_new_tokens=20,
|
| 30 |
do_sample=True,
|
| 31 |
temperature=1,
|
| 32 |
)
|
| 33 |
|
| 34 |
+
text = response["generated_text"]
|
| 35 |
+
final += text
|
| 36 |
+
yield text
|
| 37 |
|
| 38 |
+
return final
|
| 39 |
|
| 40 |
"""
|
| 41 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|