Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 19 |
|
| 20 |
|
| 21 |
st.title("💬 Chatbot")
|
| 22 |
-
st.caption("🚀 A streamlit chatbot powered by
|
| 23 |
|
| 24 |
# Initialize chat history
|
| 25 |
if 'messages' not in st.session_state:
|
|
@@ -46,7 +46,9 @@ if prompt := st.chat_input():
|
|
| 46 |
inputs = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")
|
| 47 |
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=150)
|
| 48 |
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
|
| 51 |
# Display assistant response in chat message container
|
| 52 |
st.chat_message("assistant").write(msg)
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
st.title("💬 Chatbot")
|
| 22 |
+
st.caption("🚀 A streamlit chatbot powered by Google's Gemma")
|
| 23 |
|
| 24 |
# Initialize chat history
|
| 25 |
if 'messages' not in st.session_state:
|
|
|
|
| 46 |
inputs = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")
|
| 47 |
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=150)
|
| 48 |
|
| 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)
|