Spaces:
Sleeping
Sleeping
File size: 1,027 Bytes
66b3608 48c3a0e 66b3608 5792707 66b3608 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
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)
|