forked from yash-sojitra-20/SQLify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQLify_Frontend.py
43 lines (36 loc) · 934 Bytes
/
SQLify_Frontend.py
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
41
42
43
import streamlit as st
from SQLify_Backend import get_chain, db
st.set_page_config(
page_title="SQLify App",
page_icon="📊",
layout="wide",
initial_sidebar_state="expanded"
)
st.markdown(
"""
<style>
body {
background-color: #f8f9fa;
font-family: 'Arial', sans-serif;
}
.st-bw {
color: #007BFF;
}
</style>
""",
unsafe_allow_html=True
)
st.title("SQLify: Talk to your Database🗄️")
st.markdown("---")
# Input for the user's question
question = st.text_input("Ask a Question:", "")
# Display the question and answer
if question:
# Invoke the backend and run the query
chain = get_chain()
qns = chain.invoke({"question": question})
response = db.run(qns)
st.markdown("### Query:")
st.code(qns, language="sql")
st.markdown("### Answer:")
st.code(response, language="sql")