Skip to content

Commit

Permalink
streamlit app
Browse files Browse the repository at this point in the history
  • Loading branch information
sreyakumar committed Nov 27, 2024
1 parent 612e5dd commit 38ef0b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
15 changes: 7 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Import the Streamlit library
import streamlit as st
import sys
import os

import asyncio
#from metadata_chatbot.agents.GAMER import GAMER
import uuid

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')))

import sys
import os
sys.path.insert(0, os.path.abspath('./src'))
from metadata_chatbot.agents.GAMER import GAMER
import uuid

#run on terminal with streamlit run c:/Users/sreya.kumar/Documents/GitHub/metadata-chatbot/app.py [ARGUMENTS]

Expand All @@ -17,9 +16,9 @@ async def main():

llm = GAMER()
unique_id = str(uuid.uuid4())

message = st.chat_message("assistant")
message.write("Hello!")
message.write("Hello! How can I help you?")

prompt = st.chat_input("Ask a question about the AIND Metadata!")

Expand Down
12 changes: 2 additions & 10 deletions src/metadata_chatbot/agents/GAMER.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
from langchain.callbacks.manager import AsyncCallbackManager, CallbackManagerForLLMRun
import streamlit as st



class GAMER(LLM):

def _call(
Expand Down Expand Up @@ -103,14 +101,7 @@ async def streamlit_astream(
"""
Asynchronous call.
"""

config = {"configurable":{"thread_id": unique_id}}
inputs = {
"messages": [HumanMessage(query)],
}
async def main(query: str):

unique_id = str(uuid.uuid4())
async def main(query:str):
config = {"configurable":{"thread_id": unique_id}}
inputs = {
"messages": [HumanMessage(query)],
Expand All @@ -121,6 +112,7 @@ async def main(query: str):
yield value['messages'][0].content
else:
yield value['generation']


curr = None
generation = None
Expand Down

0 comments on commit 38ef0b8

Please sign in to comment.