Spaces:
Sleeping
Sleeping
DeepMount00
commited on
Commit
•
8d3b84c
1
Parent(s):
979c1be
Update app.py
Browse files
app.py
CHANGED
@@ -64,8 +64,13 @@ def chat_llama3_8b(message: str, history: list, temperature: float, max_new_toke
|
|
64 |
decoded = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
|
65 |
prompt_end_index = decoded[0].find(message) + len(message)
|
66 |
final_response = decoded[0][prompt_end_index:] if prompt_end_index != -1 else decoded[0]
|
|
|
|
|
|
|
|
|
67 |
|
68 |
-
return final_response
|
|
|
69 |
|
70 |
|
71 |
# Gradio block
|
|
|
64 |
decoded = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
|
65 |
prompt_end_index = decoded[0].find(message) + len(message)
|
66 |
final_response = decoded[0][prompt_end_index:] if prompt_end_index != -1 else decoded[0]
|
67 |
+
|
68 |
+
final_response = final_response.strip("assistant")
|
69 |
+
if final_response.startswith(':'):
|
70 |
+
final_response = final_response.lstrip(':').strip()
|
71 |
|
72 |
+
return final_response
|
73 |
+
|
74 |
|
75 |
|
76 |
# Gradio block
|