File size: 818 Bytes
426f640 a096265 dfc3c17 a096265 dfc3c17 426f640 0111da5 426f640 cb90cfb 2da3872 a096265 dfc3c17 a096265 70b6041 cb90cfb a096265 426f640 |
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 |
from bardapi import Bard
import os
import streamlit as st
from transformers import pipeline
from getvalues import getValues
intent = pipeline(model="facebook/bart-large-mnli")
# fetchvalue = pipeline(model="Jean-Baptiste/camembert-ner", aggregation_strategy="simple")
bardkey = os.environ.get("BARD_API_KEY")
if query := st.chat_input("Hi, how can I help you"):
usrintent = intent(query, candidate_labels=["Reminder", "General Conversation"])
if usrintent["labels"][0] == "Reminder":
values = getValues(query)
with st.chat_message("assistant"):
st.write(values)
elif usrintent["labels"][0] == "General Conversation":
bard = Bard(token=bardkey)
ans = bard.get_answer(query)
with st.chat_message("assistant"):
st.write(ans['content'])
|