Commit
·
8e17490
1
Parent(s):
15e4fce
update app.py
Browse files
app.py
CHANGED
|
@@ -33,15 +33,14 @@ pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
|
| 33 |
|
| 34 |
prompt = st.text_input("Please ask your question here:")
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
# Display user message in chat message container
|
| 40 |
-
st.markdown("<b style='color:Red;'>
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
# Generate response
|
| 43 |
result = pipe(prompt)#, max_length=100, num_return_sequences=1)
|
| 44 |
-
|
| 45 |
-
# Display bot response in chat message container
|
| 46 |
-
st.markdown("<b style='color:Green;'>Bot:</b> {}".format(result[0]['generated_text']), unsafe_allow_html=True)
|
| 47 |
-
|
|
|
|
| 33 |
|
| 34 |
prompt = st.text_input("Please ask your question here:")
|
| 35 |
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
if prompt := st.chat_input("Please ask your question here:"):
|
| 39 |
# Display user message in chat message container
|
| 40 |
+
st.chat_message("user").markdown("<b style='color:Red;'>"+prompt+"</b>", unsafe_allow_html=True)
|
| 41 |
+
# Add user message to chat history
|
| 42 |
+
st.session_state.query = prompt
|
| 43 |
+
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 44 |
# Generate response
|
| 45 |
result = pipe(prompt)#, max_length=100, num_return_sequences=1)
|
| 46 |
+
|
|
|
|
|
|
|
|
|