KrSharangrav
chatbot changes
8799fb1
raw
history blame
682 Bytes
import streamlit as st
from chatbot import chatbot_response
from db import get_mongo_data
import pandas as pd
# Streamlit UI
st.title("Twitter Sentiment Analysis Chatbot")
# Display MongoDB Data
st.subheader("MongoDB Data (First 5 Rows)")
mongo_data = get_mongo_data()
if mongo_data is not None:
st.dataframe(pd.DataFrame(mongo_data).head())
# Chatbot Input
st.subheader("Chat with the Sentiment Analysis Bot")
user_input = st.text_input("Enter a tweet to analyze:")
if st.button("Analyze"):
if user_input:
response = chatbot_response(user_input)
st.write("**Sentiment Analysis Result:**", response)
else:
st.warning("Please enter a tweet.")