|
import streamlit as st |
|
import os |
|
from transformers import pipeline |
|
from bardapi import Bard |
|
import os |
|
|
|
bardkey = os.environ.get("BARD_API_KEY") |
|
|
|
bard = Bard(token=bardkey) |
|
|
|
|
|
classifi = pipeline(model="facebook/bart-large-mnli") |
|
|
|
|
|
|
|
def chatbot(): |
|
st.title("ChatBot") |
|
if message := st.chat_input("Enter your message"): |
|
ans = classifi(message, candidate_lables=["Reminder", "General Conversation"]) |
|
umsg = bard.get_answer(message)["content"] |
|
with st.chat_message("assistant"): |
|
st.write(umsg) |
|
st.write(ans) |
|
|
|
|
|
|
|
chatbot() |