Spaces:
Sleeping
Sleeping
import chainlit as cl | |
import sys | |
sys.path.append(".") | |
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 init(): | |
cl.user_session.set("chain", extract_information()) | |
await cl.Message(content="Welcome to Earnings chat!").send() | |
async def main(message: cl.Message): | |
chain = cl.user_session.get("chain") | |
res = chain.chat(message) | |
# res = await chain.aiinvoke({"input": message}) | |
# res = res["text"] | |
out = ''.join(str(res)) | |
await cl.Message(content=out).send() | |