Update app.py
Browse files
app.py
CHANGED
|
@@ -49,6 +49,29 @@ class StockAdviserUI:
|
|
| 49 |
def _setup_css(self):
|
| 50 |
st.markdown("""
|
| 51 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
.main-header {
|
| 53 |
text-align: center;
|
| 54 |
padding-right: 20px;
|
|
@@ -648,7 +671,7 @@ class StockAdviser:
|
|
| 648 |
Respond "Company {Company name} {nse company symbol}({symbol}) details not found in the RealTime Data".
|
| 649 |
"""
|
| 650 |
citation_format = """
|
| 651 |
-
Citations: [Generate few citations based on the links provided. Mention Source ('platform') and Title('title')
|
| 652 |
"""
|
| 653 |
instr2 = """
|
| 654 |
Stricktly Never mention 'document'/'documents', not even once. Instead mention it as 'Real-Time Social media and News data'
|
|
@@ -796,9 +819,38 @@ def main(hugg):
|
|
| 796 |
|
| 797 |
# Main content
|
| 798 |
cmp_tr = "NOTICKER"
|
| 799 |
-
|
| 800 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 801 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 802 |
if user_question.strip():
|
| 803 |
cmp_tr = adviser.get_symbol(user_question)
|
| 804 |
sentiment_response = "none"
|
|
|
|
| 49 |
def _setup_css(self):
|
| 50 |
st.markdown("""
|
| 51 |
<style>
|
| 52 |
+
/* Make the top bar transparent */
|
| 53 |
+
.css-18e3th9 { /* Class for main content area */
|
| 54 |
+
padding-top: 0rem;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.css-1d391kg { /* Class for the header section */
|
| 58 |
+
background-color: rgba(0, 0, 0, 0) !important; /* Make transparent */
|
| 59 |
+
box-shadow: none; /* Remove shadow if there is one */
|
| 60 |
+
}
|
| 61 |
+
/* Target the first markdown element in the Streamlit app */
|
| 62 |
+
.css-1v0mbdj {
|
| 63 |
+
font-size: 0px !important;
|
| 64 |
+
height: 0px !important;
|
| 65 |
+
padding: 0px !important;
|
| 66 |
+
margin: 0px !important;
|
| 67 |
+
}
|
| 68 |
+
/* Reduce or remove the top margin */
|
| 69 |
+
.css-18e3th9 {
|
| 70 |
+
padding-top: 0rem;
|
| 71 |
+
}
|
| 72 |
+
.css-1v3fvcr {
|
| 73 |
+
padding-top: 1rem;
|
| 74 |
+
}
|
| 75 |
.main-header {
|
| 76 |
text-align: center;
|
| 77 |
padding-right: 20px;
|
|
|
|
| 671 |
Respond "Company {Company name} {nse company symbol}({symbol}) details not found in the RealTime Data".
|
| 672 |
"""
|
| 673 |
citation_format = """
|
| 674 |
+
Citations: [Generate few citations based on the links provided. Mention Source ('platform') and Title('title')](hyperlink them with url from corresponding 'link')
|
| 675 |
"""
|
| 676 |
instr2 = """
|
| 677 |
Stricktly Never mention 'document'/'documents', not even once. Instead mention it as 'Real-Time Social media and News data'
|
|
|
|
| 819 |
|
| 820 |
# Main content
|
| 821 |
cmp_tr = "NOTICKER"
|
| 822 |
+
|
| 823 |
+
# Define example queries
|
| 824 |
+
example_queries = [
|
| 825 |
+
"0. ",
|
| 826 |
+
"1. Is it a good time to buy bharati airtel ?",
|
| 827 |
+
"2. Advise about vodafone idea ltd ?",
|
| 828 |
+
"3. is TCS stock good to invest? advise and tell how it is now.",
|
| 829 |
+
"4. Advise on HDFC bank and provide statistics.",
|
| 830 |
+
"5. How about Asian Paints ?",
|
| 831 |
+
"6. Advise about the company that manufactures swift car and provide stats?",
|
| 832 |
+
"7. Any thoughts on N.R. Narayana Murthy's company?",
|
| 833 |
+
"8. Opinion and current values of the company that broadcasts 'Sa Re Ga Ma Pa 2024' ?"
|
| 834 |
+
]
|
| 835 |
+
|
| 836 |
+
selected_query = ""
|
| 837 |
+
|
| 838 |
+
# Layout with two columns
|
| 839 |
+
cola1, cola2 = st.columns([3, 1])
|
| 840 |
+
|
| 841 |
+
# inp
|
| 842 |
+
with cola1:
|
| 843 |
+
st.header("Ask a question")
|
| 844 |
|
| 845 |
+
# Dropdown in the right column
|
| 846 |
+
with cola2:
|
| 847 |
+
selected_query = st.selectbox("Example Queries", example_queries, index=0)
|
| 848 |
+
|
| 849 |
+
# Automatically update text input when a new example is selected
|
| 850 |
+
if selected_query:
|
| 851 |
+
query_text = selected_query.split(". ", 1)[1] if selected_query != example_queries[0] else ""
|
| 852 |
+
user_question = st.text_input("Please ask statistical or advice or both related questions on a NSE stock.",value=query_text if selected_query else "", key="user_question")
|
| 853 |
+
|
| 854 |
if user_question.strip():
|
| 855 |
cmp_tr = adviser.get_symbol(user_question)
|
| 856 |
sentiment_response = "none"
|