QuaidKhalid commited on
Commit
427dfec
·
verified ·
1 Parent(s): a866660

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -7
app.py CHANGED
@@ -3,6 +3,7 @@ from groq import Groq
3
  from langchain_groq import ChatGroq
4
  from langchain import hub
5
  from langchain_chroma import Chroma
 
6
  from langchain.document_loaders import WebBaseLoader
7
  from langchain_core.output_parsers import StrOutputParser
8
  from langchain_core.runnables import RunnablePassthrough
@@ -48,22 +49,42 @@ def extract_text_from_url(url):
48
  # Set the page layout to wide for better UI space
49
  st.set_page_config(page_title="IESCO Query Application", layout="wide")
50
 
51
- # Main UI layout
 
52
  st.title("IESCO Query Application")
 
 
 
 
 
 
 
 
 
53
 
54
  url = "https://iesco.com.pk/index.php/customer-services/tariff-guide#"
55
  document_text = extract_text_from_url(url)
 
56
 
57
- st.write("Extracted Text:")
58
- st.text_area("", document_text, height=200, disabled=True)
59
-
60
- query = st.text_input("Enter your query")
61
 
62
  if st.button("Submit"):
63
  if query:
64
  with st.spinner("Generating response..."):
65
  response = generate_response_groq(document_text, query)
66
- st.write("Response:")
67
  st.write(response)
68
  else:
69
- st.error("Please enter a query.")
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  from langchain_groq import ChatGroq
4
  from langchain import hub
5
  from langchain_chroma import Chroma
6
+ from langchain_community.document_loaders import WebBaseLoader
7
  from langchain.document_loaders import WebBaseLoader
8
  from langchain_core.output_parsers import StrOutputParser
9
  from langchain_core.runnables import RunnablePassthrough
 
49
  # Set the page layout to wide for better UI space
50
  st.set_page_config(page_title="IESCO Query Application", layout="wide")
51
 
52
+
53
+ # # Main UI layout
54
  st.title("IESCO Query Application")
55
+ # st.markdown("""
56
+ # <style>
57
+ # .main-content {background-color: #f0f2f6; padding: 20px; border-radius: 10px;}
58
+ # .stButton>button {background-color: #4CAF50; color: white; font-size: 16px; border-radius: 10px;}
59
+ # .stTextInput>div>div>input {background-color: #f0f2f6; color: black; border-radius: 5px;}
60
+ # </style>
61
+ # """, unsafe_allow_html=True)
62
+
63
+ st.markdown("<div class='main-content'>", unsafe_allow_html=True)
64
 
65
  url = "https://iesco.com.pk/index.php/customer-services/tariff-guide#"
66
  document_text = extract_text_from_url(url)
67
+ st.text_area("Extracted Text", document_text, height=200)
68
 
69
+ query = st.text_input("🔍 Enter your query")
 
 
 
70
 
71
  if st.button("Submit"):
72
  if query:
73
  with st.spinner("Generating response..."):
74
  response = generate_response_groq(document_text, query)
75
+ st.write("**Response:**")
76
  st.write(response)
77
  else:
78
+ st.error("Please enter a query.")
79
+
80
+ st.markdown("</div>", unsafe_allow_html=True)
81
+
82
+ # Customize the theme and color contrast
83
+ st.markdown("""
84
+ <style>
85
+ .css-1aumxhk {background-color: #E8EAF6;}
86
+ .stTextInput>div>div>input {border-color: #3f51b5;}
87
+ .stTextArea>div>div>textarea {border-color: #3f51b5;}
88
+ .stButton>button {background-color: #3f51b5; color: white; font-size: 16px;}
89
+ </style>
90
+ """, unsafe_allow_html=True)