poemsforaphrodite commited on
Commit
d341aca
·
verified ·
1 Parent(s): 8bf8b6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -270,7 +270,8 @@ def analyze_competitors(row, co):
270
  our_url = row['page']
271
  our_score = row['relevancy_score']
272
 
273
- competitor_urls = get_serp_results(query)[:5] # Get top 5 competitors
 
274
 
275
  results = []
276
  for url in competitor_urls:
@@ -504,7 +505,8 @@ def show_tabular_data(df, co):
504
  our_url = row['page']
505
  our_score = row['relevancy_score']
506
 
507
- competitor_urls = get_serp_results(query)[:5] # Get top 5 competitors
 
508
 
509
  results = []
510
  for url in competitor_urls:
@@ -543,7 +545,15 @@ def show_tabular_data(df, co):
543
  st.dataframe(results_df)
544
 
545
  our_rank = results_df.index[results_df['url'] == row['page']].tolist()[0] + 1
546
- st.write(f"Our page ranks {our_rank} out of {len(results_df)} in terms of relevancy score.")
 
 
 
 
 
 
 
 
547
 
548
  return df # Return the updated dataframe
549
 
 
270
  our_url = row['page']
271
  our_score = row['relevancy_score']
272
 
273
+ competitor_urls = get_serp_results(query)
274
+ competitor_urls = [url for url in competitor_urls if not url.startswith('/search')][:5] # Get top 5 valid competitors
275
 
276
  results = []
277
  for url in competitor_urls:
 
505
  our_url = row['page']
506
  our_score = row['relevancy_score']
507
 
508
+ competitor_urls = get_serp_results(query)
509
+ competitor_urls = [url for url in competitor_urls if not url.startswith('/search')][:5] # Get top 5 valid competitors
510
 
511
  results = []
512
  for url in competitor_urls:
 
545
  st.dataframe(results_df)
546
 
547
  our_rank = results_df.index[results_df['url'] == row['page']].tolist()[0] + 1
548
+ total_results = len(results_df)
549
+ st.write(f"Our page ranks {our_rank} out of {total_results} in terms of relevancy score.")
550
+
551
+ if our_rank == 1:
552
+ st.success("Your page has the highest relevancy score!")
553
+ elif our_rank <= 3:
554
+ st.info("Your page is among the top 3 most relevant results.")
555
+ elif our_rank > total_results / 2:
556
+ st.warning("Your page's relevancy score is in the lower half of the results. Consider optimizing your content.")
557
 
558
  return df # Return the updated dataframe
559