make thinking tokens italic
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from llama_cpp import Llama
|
3 |
|
@@ -44,8 +45,9 @@ def respond(
|
|
44 |
for message in completion:
|
45 |
delta = message['choices'][0]['delta']
|
46 |
if 'content' in delta:
|
47 |
-
response += delta['content']
|
48 |
-
|
|
|
49 |
|
50 |
|
51 |
demo = gr.ChatInterface(
|
|
|
1 |
+
import re
|
2 |
import gradio as gr
|
3 |
from llama_cpp import Llama
|
4 |
|
|
|
45 |
for message in completion:
|
46 |
delta = message['choices'][0]['delta']
|
47 |
if 'content' in delta:
|
48 |
+
# response += delta['content']
|
49 |
+
formatted_response = re.sub(r'<think>(.*?)</think>', r'*\1*', response)
|
50 |
+
yield formatted_response
|
51 |
|
52 |
|
53 |
demo = gr.ChatInterface(
|