Spaces:
Runtime error
Runtime error
Download app.py from coolgandhi/CodePathAI: direct link, hf CLI and curl.
- Browser
- Download file 764 Bytes
-
https://huggingface.co/spaces/coolgandhi/CodePathAI/resolve/main/app.py
- Command line
-
hf download hf://spaces/coolgandhi/CodePathAI/app.py
-
curl -L -o app.py https://huggingface.co/spaces/coolgandhi/CodePathAI/resolve/main/app.py
764 Bytes
| import chainlit as cl | |
| from chainlit.input_widget import TextInput | |
| from rag import RAGModel | |
| import os | |
| import nest_asyncio | |
| nest_asyncio.apply() | |
| # Initialize RAG model | |
| rag_model = RAGModel(openai_api_key=os.getenv("OPENAI_API_KEY")) | |
| async def main(message): | |
| result = rag_model.query(message.content) | |
| print(result) | |
| await cl.Message(result).send() | |
| # @cl.application | |
| # def app(): | |
| # cl.TextInput(label="Enter your query", on_submit=handle_message) | |
| async def start(): | |
| #def on_chat_start(): | |
| msg=cl.Message(content="Firing up the research info bot...") | |
| await msg.send() | |
| msg.content= "Hi, welcome to research info bot. What is your query?" | |
| await msg.update() | |
| # if __name__ == "__main__": | |
| # cl.run() | |