Spaces:
Runtime error
Runtime error
michailroussos
commited on
Commit
·
6195f56
1
Parent(s):
9b00c4f
more
Browse files
app.py
CHANGED
@@ -46,6 +46,9 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
46 |
)
|
47 |
response = tokenizer.decode(generated_tokens[0], skip_special_tokens=True)
|
48 |
|
|
|
|
|
|
|
49 |
# Update history
|
50 |
if history is None:
|
51 |
history = []
|
@@ -53,6 +56,7 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
53 |
|
54 |
print("history:")
|
55 |
print(history)
|
|
|
56 |
# Format history for Gradio (strictly enforce the role-content format)
|
57 |
formatted_history = []
|
58 |
for entry in history:
|
@@ -65,6 +69,7 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
65 |
return formatted_history
|
66 |
|
67 |
|
|
|
68 |
# Define the Gradio interface
|
69 |
demo = gr.ChatInterface(
|
70 |
fn=respond,
|
|
|
46 |
)
|
47 |
response = tokenizer.decode(generated_tokens[0], skip_special_tokens=True)
|
48 |
|
49 |
+
# Clean the response to remove any unwanted system content (if any)
|
50 |
+
response = response.replace("system", "").strip()
|
51 |
+
|
52 |
# Update history
|
53 |
if history is None:
|
54 |
history = []
|
|
|
56 |
|
57 |
print("history:")
|
58 |
print(history)
|
59 |
+
|
60 |
# Format history for Gradio (strictly enforce the role-content format)
|
61 |
formatted_history = []
|
62 |
for entry in history:
|
|
|
69 |
return formatted_history
|
70 |
|
71 |
|
72 |
+
|
73 |
# Define the Gradio interface
|
74 |
demo = gr.ChatInterface(
|
75 |
fn=respond,
|