poemsforaphrodite commited on
Commit
92f9443
1 Parent(s): 21947e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -25
app.py CHANGED
@@ -60,7 +60,7 @@ def setup_streamlit():
60
  st.set_page_config(page_title="Keyword Relevance Test", layout="wide")
61
  st.title("Keyword Relevance Test Using Vector Embedding")
62
  st.divider()
63
- #logging.info("Streamlit app configured")
64
 
65
  def init_session_state():
66
  if 'selected_property' not in st.session_state:
@@ -487,32 +487,21 @@ def show_model_type_selector():
487
  )
488
 
489
  def show_tabular_data(df, co):
490
- st.write("Data Table with Relevancy Scores and Competitor Analysis")
491
 
 
 
 
 
492
  for index, row in df.iterrows():
493
- with st.expander(f"Query: {row['query']} | Page: {row['page']}"):
494
- col1, col2 = st.columns(2)
495
-
496
- with col1:
497
- st.write("GSC Data:")
498
- st.write(f"URL: {row['page']}")
499
- st.write(f"Query: {row['query']}")
500
- st.write(f"Impressions: {row['impressions']}")
501
- st.write(f"Clicks: {row['clicks']}")
502
- st.write(f"Position: {row['position']}")
503
- st.write(f"Relevancy Score: {row['relevancy_score']:.4f}")
504
-
505
- with col2:
506
- st.write("Competitor Analysis:")
507
- if st.button("Analyze Competitors", key=f"comp_{index}"):
508
- with st.spinner('Analyzing competitors...'):
509
- results_df = analyze_competitors(row, co)
510
- st.dataframe(results_df)
511
-
512
- our_rank = results_df.index[results_df['url'] == row['page']].tolist()[0] + 1
513
- st.write(f"Our page ranks {our_rank} out of {len(results_df)} in terms of relevancy score.")
514
-
515
-
516
 
517
  def show_date_range_selector():
518
  # logging.info("Showing date range selector")
 
60
  st.set_page_config(page_title="Keyword Relevance Test", layout="wide")
61
  st.title("Keyword Relevance Test Using Vector Embedding")
62
  st.divider()
63
+ logging.info("Streamlit app configured")
64
 
65
  def init_session_state():
66
  if 'selected_property' not in st.session_state:
 
487
  )
488
 
489
  def show_tabular_data(df, co):
490
+ st.write("Data Table with Relevancy Scores")
491
 
492
+ # Display the dataframe as a table
493
+ st.dataframe(df)
494
+
495
+ # Add an expander for each row to show competitor analysis
496
  for index, row in df.iterrows():
497
+ with st.expander(f"Analyze Competitors for: {row['query']} | {row['page']}"):
498
+ if st.button("Analyze Competitors", key=f"comp_{index}"):
499
+ with st.spinner('Analyzing competitors...'):
500
+ results_df = analyze_competitors(row, co)
501
+ st.dataframe(results_df)
502
+
503
+ our_rank = results_df.index[results_df['url'] == row['page']].tolist()[0] + 1
504
+ st.write(f"Our page ranks {our_rank} out of {len(results_df)} in terms of relevancy score.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
 
506
  def show_date_range_selector():
507
  # logging.info("Showing date range selector")