Spaces:
Sleeping
Sleeping
File size: 716 Bytes
9e04f95 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from transformers import pipeline, Conversation
# import streamlit_option_menu
import streamlit as st
def Chat():
query = st.chat_input("Enter your query")
convo = pipeline("conversational")
oracle = pipeline(task="zero-shot-classification", model="facebook/bart-large-mnli")
usrinput = Conversation(query)
chitchat = convo(usrinput)
ans = oracle(
query,
candidate_labels=["logout"])
if ans["scores"][0] > 0.85:
st.session_state["user"] = "visitor"
with st.chat_message("assistant"):
"You are now sleeping in dream"
st.experimental_rerun()
else:
with st.chat_message("assistant"):
chitchat
Chat()
|