IBMHackRAG / app.py
BaRiDo's picture
Update app.py
5792707 verified
raw
history blame
1.03 kB
import os
import getpass
import sentence_transformers
import streamlit as st
# Streamlit UI
st.title("πŸ” IBM Watson RAG Chatbot")
# User input in Streamlit
question = st.text_input("Enter your question:")
if question:
# Retrieve relevant grounding context
grounding = RAG_proximity_search(question)
# Format the question with retrieved context
formatted_question = f"""<|start_of_role|>user<|end_of_role|>Use the following pieces of context to answer the question.
{grounding}
Question: {question}<|end_of_text|>
<|start_of_role|>assistant<|end_of_role|>"""
# Placeholder for a prompt input (Optional)
prompt_input = "" # Set this dynamically if needed
prompt = f"""{prompt_input}{formatted_question}"""
# Simulated AI response (Replace with actual model call)
generated_response = f"AI Response based on: {prompt}"
# Display results
st.subheader("πŸ“Œ Retrieved Context")
st.write(grounding)
st.subheader("πŸ€– AI Response")
st.write(generated_response)