KrSharangrav commited on
Commit
f2ddc64
Β·
1 Parent(s): f453bef

change in UI image

Browse files
Files changed (1) hide show
  1. app.py +26 -29
app.py CHANGED
@@ -3,38 +3,35 @@ import pandas as pd
3
  from db import insert_data_if_empty, get_mongo_client
4
  from chatbot import chatbot_response
5
 
 
 
 
 
6
  # Ensure historical data is inserted into MongoDB if not already present.
7
  insert_data_if_empty()
8
 
9
  # Connect to MongoDB (optional: for additional visualizations)
10
  collection = get_mongo_client()
11
 
12
- # Create a two-column layout: left for the image, right for the chatbot UI.
13
- col1, col2 = st.columns([1, 3])
14
-
15
- with col1:
16
- st.image("https://huggingface.co/spaces/sharangrav24/SentimentAnalysis/resolve/main/sentiment.png", use_column_width=True)
17
-
18
- with col2:
19
- st.subheader("πŸ’¬ Chatbot with Sentiment Analysis & Category Extraction")
20
-
21
- # Create an expander to display example questions on separate lines.
22
- with st.expander("πŸ‘‹ Hi, allow me to help you with prompts:"):
23
- st.write("πŸ’‘ Provide analysis for data entry 1 in the dataset")
24
- st.write("πŸ’‘ What is the dataset summary?")
25
- st.write("πŸ’‘ or just ask me something of your own, I'll be happy to help 😊")
26
-
27
- # Text area for user input.
28
- user_prompt = st.text_area("Ask me something:")
29
-
30
- if st.button("Get Response"):
31
- ai_response, sentiment_label, sentiment_confidence, topic_label, topic_confidence = chatbot_response(user_prompt)
32
- if ai_response:
33
- st.write("### Response:")
34
- st.markdown(ai_response)
35
- st.write("### Sentiment Analysis:")
36
- st.write(f"**Sentiment Detected:** {sentiment_label} ({sentiment_confidence*100:.2f}% confidence)")
37
- st.write("### Category Extraction:")
38
- st.write(f"**Category Detected:** {topic_label} ({topic_confidence*100:.2f}% confidence)")
39
- else:
40
- st.warning("⚠️ Please enter a question or text for analysis.")
 
3
  from db import insert_data_if_empty, get_mongo_client
4
  from chatbot import chatbot_response
5
 
6
+ # Sidebar: Display image and title.
7
+ st.sidebar.image("https://huggingface.co/spaces/sharangrav24/SentimentAnalysis/resolve/main/sentiment.png", width=100)
8
+ st.sidebar.markdown("## Group A Submission - Python")
9
+
10
  # Ensure historical data is inserted into MongoDB if not already present.
11
  insert_data_if_empty()
12
 
13
  # Connect to MongoDB (optional: for additional visualizations)
14
  collection = get_mongo_client()
15
 
16
+ st.subheader("πŸ’¬ Chatbot with Sentiment Analysis & Category Extraction")
17
+
18
+ # Create an expander to display example questions on separate lines.
19
+ with st.expander("πŸ‘‹ Hi, allow me to help you with prompts:"):
20
+ st.write("πŸ’‘ Provide analysis for data entry 1 in the dataset")
21
+ st.write("πŸ’‘ What is the dataset summary?")
22
+ st.write("πŸ’‘ or just ask me something of your own, I'll be happy to help 😊")
23
+
24
+ # Text area for user input.
25
+ user_prompt = st.text_area("Ask me something:")
26
+
27
+ if st.button("Get Response"):
28
+ ai_response, sentiment_label, sentiment_confidence, topic_label, topic_confidence = chatbot_response(user_prompt)
29
+ if ai_response:
30
+ st.write("### Response:")
31
+ st.markdown(ai_response)
32
+ st.write("### Sentiment Analysis:")
33
+ st.write(f"**Sentiment Detected:** {sentiment_label} ({sentiment_confidence*100:.2f}% confidence)")
34
+ st.write("### Category Extraction:")
35
+ st.write(f"**Category Detected:** {topic_label} ({topic_confidence*100:.2f}% confidence)")
36
+ else:
37
+ st.warning("⚠️ Please enter a question or text for analysis.")