Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from modules import model_selection, retrieve_query
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# Streamlit functions to select the model
|
| 6 |
+
model, api_key = model_selection()
|
| 7 |
+
|
| 8 |
+
# RAG CHATBOT Interface
|
| 9 |
+
st.header("Rag Chatbot")
|
| 10 |
+
st.divider()
|
| 11 |
+
#-----------------------------------------------------
|
| 12 |
+
query = st.chat_input(placeholder="Enter Your Message")
|
| 13 |
+
if query:
|
| 14 |
+
user_message = st.chat_message("User").write(query)
|
| 15 |
+
response = retrieve_query(
|
| 16 |
+
query=query,
|
| 17 |
+
df="Data/products.csv",
|
| 18 |
+
column="product_info",
|
| 19 |
+
api_key=api_key,
|
| 20 |
+
model=model
|
| 21 |
+
)
|
| 22 |
+
ai_message = st.chat_message("AI").write(response)
|