Update space
Browse files
app.py
CHANGED
@@ -16,31 +16,21 @@ def respond(
|
|
16 |
temperature,
|
17 |
top_p,
|
18 |
):
|
19 |
-
#
|
20 |
-
prompt =
|
21 |
|
22 |
-
for user_msg, assistant_msg in history:
|
23 |
-
prompt += f"User: {user_msg}\n"
|
24 |
-
if assistant_msg:
|
25 |
-
prompt += f"Assistant: {assistant_msg}\n"
|
26 |
-
|
27 |
-
prompt += f"User: {message}\nAssistant:"
|
28 |
-
|
29 |
response = ""
|
30 |
try:
|
31 |
-
#
|
32 |
-
|
33 |
prompt,
|
34 |
max_new_tokens=max_tokens,
|
35 |
temperature=temperature,
|
36 |
top_p=top_p,
|
37 |
-
|
38 |
-
|
39 |
-
if chunk:
|
40 |
-
response += chunk
|
41 |
-
yield response
|
42 |
except Exception as e:
|
43 |
-
|
44 |
|
45 |
"""
|
46 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
|
|
16 |
temperature,
|
17 |
top_p,
|
18 |
):
|
19 |
+
# Simpler prompt format
|
20 |
+
prompt = message
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
response = ""
|
23 |
try:
|
24 |
+
# Basic text generation without streaming first
|
25 |
+
response = client.text_generation(
|
26 |
prompt,
|
27 |
max_new_tokens=max_tokens,
|
28 |
temperature=temperature,
|
29 |
top_p=top_p,
|
30 |
+
)
|
31 |
+
return response
|
|
|
|
|
|
|
32 |
except Exception as e:
|
33 |
+
return f"Error: {str(e)}"
|
34 |
|
35 |
"""
|
36 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|