Spaces:
Sleeping
Sleeping
| import sys | |
| sys.path.append(".") | |
| import chainlit as cl | |
| from earnings_app import extract_information | |
| def rename(orig_author: str): | |
| diamond_char = u'\U0001F537' | |
| phrase = diamond_char + " Diamond Hands " + diamond_char | |
| rename_dict = {"RetrievalQA": phrase} | |
| return rename_dict.get(orig_author, orig_author) | |
| async def start(): | |
| """ | |
| This is called when the Chainlit chat is started! | |
| """ | |
| chain = await extract_information() | |
| cl.user_session.set("chain", chain) | |
| await cl.Message("Welcome to the information extraction chat!").send() | |
| async def main(message: cl.Message): | |
| """ | |
| This is called when a message is received! | |
| """ | |
| chain = cl.user_session.get("chain") | |
| res = await chain.achat(message) | |
| # res = await chain.aiinvoke({"input": message}) | |
| # res = res["text"] | |
| out = str(res) | |
| await cl.Message(content=out).send() | |