Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,10 @@ import transformers
|
|
| 3 |
import torch
|
| 4 |
import streamlit as st
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
model_id = "google/gemma-1.1-2b-it"
|
| 7 |
dtype = torch.bfloat16
|
| 8 |
|
|
@@ -49,6 +53,9 @@ if prompt := st.chat_input():
|
|
| 49 |
|
| 50 |
|
| 51 |
msg = tokenizer.decode(outputs[0]) #output[0]['generated_text']
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
# Display assistant response in chat message container
|
| 54 |
st.chat_message("assistant").write(msg)
|
|
|
|
| 3 |
import torch
|
| 4 |
import streamlit as st
|
| 5 |
|
| 6 |
+
import re
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
model_id = "google/gemma-1.1-2b-it"
|
| 11 |
dtype = torch.bfloat16
|
| 12 |
|
|
|
|
| 53 |
|
| 54 |
|
| 55 |
msg = tokenizer.decode(outputs[0]) #output[0]['generated_text']
|
| 56 |
+
|
| 57 |
+
msg = re.sub(r'<.*?>', '', msg)
|
| 58 |
+
|
| 59 |
|
| 60 |
# Display assistant response in chat message container
|
| 61 |
st.chat_message("assistant").write(msg)
|