OscarFAI commited on
Commit
b951ea5
·
1 Parent(s): 11dd5a9

Stripped assistant

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -100,11 +100,14 @@ def chat_llama3_8b(message: str,
100
  t.start()
101
 
102
  outputs = []
 
103
  for text in streamer:
 
 
 
 
104
  outputs.append(text)
105
- #print(outputs)
106
- yield "".join(outputs)
107
-
108
 
109
  # Gradio block
110
  chatbot=gr.Chatbot(height=450, placeholder=PLACEHOLDER, label='Gradio ChatInterface')
 
100
  t.start()
101
 
102
  outputs = []
103
+ first_chunk = True
104
  for text in streamer:
105
+ if first_chunk and text.startswith("assistant"):
106
+ text = text[len("assistant"):].lstrip(": \n") # Remove "assistant" and any following symbols
107
+ first_chunk = False
108
+
109
  outputs.append(text)
110
+ yield "".join(outputs)
 
 
111
 
112
  # Gradio block
113
  chatbot=gr.Chatbot(height=450, placeholder=PLACEHOLDER, label='Gradio ChatInterface')