-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrountend.py
More file actions
32 lines (27 loc) · 975 Bytes
/
frountend.py
File metadata and controls
32 lines (27 loc) · 975 Bytes
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
#Step3: Build Streamlit frontend
import streamlit as st
from main import get_data_from_database
st.set_page_config(
page_title="AI Data Analyst 2.0",
page_icon="🤖",
layout="centered"
)
st.title(" AI Data Analyst 2.0")
st.markdown("Ask questions about your data in natural language.")
user_query = st.text_area(" Enter your question:", placeholder="e.g., Total products sold in 2025")
if st.button("Analyze"):
if user_query.strip() == "":
st.warning("Please enter a question to analyze.")
else:
with st.spinner("Analyzing your query..."):
database_response = get_data_from_database(user_query)
fixed_answer = f" Here's the analysis for your query:\n\n**{database_response}**"
st.success("Analysis complete!")
st.markdown(fixed_answer)
st.markdown("""
<style>
textarea {
font-size: 16px !important;
}
</style>
""", unsafe_allow_html=True)