-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
58 lines (37 loc) · 1.62 KB
/
main.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import streamlit as st
#from extract_transcript import speech_to_text
from extract_reviews import get_top_review, get_word_cloud, plot_sentiment
from product_QA import get_answer
st.title('Amazon Product Review Analysis')
st.write("Key Features of Applications:")
st.markdown("1. Extract top reviews from the product page")
st.markdown("2. Temporal Sentiment Analysis")
st.markdown("3. Keyword Extraction")
#create a streamlit text box for writing the text for the user
#create a slide bar for adding multiple drop down options
option = st.sidebar.selectbox(
'Select the option',
('Top Reviews', 'Product Chatbot'))
if option == 'Top Reviews':
url = st.text_area("Enter the url for the product")
if st.button('Submit'):
df=get_top_review(url)
tab1, tab2, tab3 = st.tabs(["🗃 Data","📈 Temporal Sentiment Analysis", "📊 Keyword Extraction"])
tab1.subheader("Extracted Data")
tab2.subheader("Sentiment Trend Analysis")
tab3.subheader("Keyword Extraction")
with tab1:
st.table(df)
with tab2:
plot_sentiment(df)
with tab3:
get_word_cloud(df['Reviews'])
elif option == 'Product Chatbot':
# insert image in streamlit
image = st.image('bert-model-calssification-output-vector-cls.png')
description = st.text_area("Enter about this product information")
question=st.text_area("Enter the question")
if st.button('Submit'):
answer=get_answer(question,description)
st.write(answer)
#create a streamlit tab on the top of the page and add the options