I'm very new to streamlit. I want to create a demo app to demonstrate the benchmark of two approaches.
For easy comparison I want create two chat bot column in the same page and one box above (or below) for input question.
It's better for two models to generate at the same time. (maybe use multi processing) I don't know how to do this too. But if can't its okay too.
Please show me a code to do it.
Sorry I was too rush . Here is simple solution:
prompt = st.chat_input("Enter your question here...")
col1, col2 = st.columns(spec=2, gap="medium")
with col1:
st.header("⚡️ Event-centric Graph RAG")
st.empty()
# display pdf, e.g. st.markdown(f'<iframe src="......." width=100% height="550"></iframe>', unsafe_allow_html=True)
messages = st.container(height=400)
if prompt:
messages.chat_message("user").write(prompt)
stream = subgraph_retriever.run(prompt)
ms = messages.chat_message("assistant").write_stream(stream)
with open("log.txt", "a") as f:
f.write("-"*10)
f.write('\n' + prompt + '||' + ms)
with col2:
# if option == "GraphRAG (Microsoft)":
# # chatbot with st.chat_input
# st.header("🏂️ GraphRAG (Microsoft)")
# st.empty()
# # display pdf, e.g. st.markdown(f'<iframe src="......." width=100% height="550"></iframe>', unsafe_allow_html=True)
# messages = st.container(height=400)
# if prompt:
# messages.chat_message("user").write(prompt)
# result = run_local_search(root_dir="/home/nld/kgqa_graphrag/ragtest", query=prompt)
# # nodes = pd.read_parquet("/home/nld/kgqa_graphrag/ragtest/output/20240815-071015/artifacts/create_final_nodes.parquet")
# # entities = pd.read_parquet("/home/nld/kgqa_graphrag/ragtest/output/20240815-071015/artifacts/create_final_entities.parquet")
# # community_reports = pd.read_parquet("/home/nld/kgqa_graphrag/ragtest/output/20240815-071015/artifacts/create_final_community_reports.parquet")
# # response_type = "Multiple Paragraphs"
# # result = local_search(
# # nodes=nodes,
# # entities=entities,
# # community_reports=community_reports,
# # response_type=response_type,
# #
# # )
# result = result.replace("#","")
# messages.chat_message("assistant").write(result)
# else: