Spaces:
Running
Running
import streamlit | |
import logging | |
st.markdown("<h1 style='text-align: center; color: #666666;'>Vector Database RAG Proof of Concept</h1>", unsafe_allow_html=True) | |
st.markdown("<h6 style='text-align: center; color: #666666;'>V1</h6>", unsafe_allow_html=True) | |
logger = logging.getLogger(__name__) | |
logging.basicConfig(level=logging.INFO) | |
###################################################################### | |
# MAINLINE | |
# | |
logger.info("#### MAINLINE ENTERED.") | |
systemTextArea = st.empty() | |
userTextArea = st.empty() | |
ragPromptTextArea = st.empty() | |
responseTextArea = st.empty() | |
selectRag = st.checkbox("Enable Query With RAG", \ | |
value=False, \ | |
key="selectRag", \ | |
help=None, \ | |
on_change=None, \ | |
args=None, \ | |
kwargs=None, \ | |
*, \ | |
disabled=False, \ | |
label_visibility="visible" \ | |
) | |
submitButton = st.button(label, \ | |
key=None, \ | |
help=None, \ | |
on_click=None, \ | |
args=None, \ | |
kwargs=None, \ | |
*, type="secondary", \ | |
disabled=False, \ | |
use_container_width=False \ | |
) | |
# Display UI | |
logger.debug("### Before displaying UI: ") | |
display(systemTextArea) | |
display(userTextArea) | |
display(ragPromptTextArea) | |
display(responseTextArea) | |
display(selectRag) | |
display(submitButton) | |
def runLLM(prompt): | |
result = "" | |
return(result) | |
def setPrompt(pprompt,ragFlag): | |
userPrompt = "" | |
return userPrompt | |
def on_submitButton_clicked(b): | |
with output_widget: | |
clear_output(wait=True) | |
ragPromptTextArea.value = "" | |
responseTextArea.value = "" | |
log.debug(f"### selectRag: {selectRag.value}") | |
prompt = setPrompt(userTextArea.value,selectRag.value)user | |
log.debug("### prompt: " + prompt) | |
runLLM(prompt) | |
logger.info("\n### Before calling submitButton.on_click().") | |
submitButton.on_click(on_submitButton_clicked) | |
display(output_widget) | |