Spaces:
Running
Running
poemsforaphrodite
commited on
Commit
•
42a9dff
1
Parent(s):
3dc4358
Update app.py
Browse files
app.py
CHANGED
@@ -664,8 +664,16 @@ def show_tabular_data(df, co, country_code):
|
|
664 |
|
665 |
# Competitors column
|
666 |
if not pd.isna(row.relevancy_score) and row.relevancy_score != 0:
|
667 |
-
|
668 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
st.write(f"Competitor Analysis for: {row.query}")
|
670 |
with st.spinner('Analyzing competitors...'):
|
671 |
results_df = analyze_competitors(row._asdict(), co, country_code=country_code)
|
@@ -721,7 +729,13 @@ def show_tabular_data(df, co, country_code):
|
|
721 |
""",
|
722 |
unsafe_allow_html=True
|
723 |
)
|
724 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
725 |
compare_with_top_result(row._asdict(), co, country_code)
|
726 |
else:
|
727 |
cols[8].write("N/A")
|
|
|
664 |
|
665 |
# Competitors column
|
666 |
if not pd.isna(row.relevancy_score) and row.relevancy_score != 0:
|
667 |
+
competitor_key = f"comp_{i}"
|
668 |
+
compare_key = f"compare_{i}"
|
669 |
+
|
670 |
+
if competitor_key not in st.session_state:
|
671 |
+
st.session_state[competitor_key] = False
|
672 |
+
|
673 |
+
if st.button("Show", key=competitor_key):
|
674 |
+
st.session_state[competitor_key] = True
|
675 |
+
|
676 |
+
if st.session_state[competitor_key]:
|
677 |
st.write(f"Competitor Analysis for: {row.query}")
|
678 |
with st.spinner('Analyzing competitors...'):
|
679 |
results_df = analyze_competitors(row._asdict(), co, country_code=country_code)
|
|
|
729 |
""",
|
730 |
unsafe_allow_html=True
|
731 |
)
|
732 |
+
if compare_key not in st.session_state:
|
733 |
+
st.session_state[compare_key] = False
|
734 |
+
|
735 |
+
if st.button("Compare Your Relevancy Score to the Page In First Place", key=compare_key):
|
736 |
+
st.session_state[compare_key] = True
|
737 |
+
|
738 |
+
if st.session_state[compare_key]:
|
739 |
compare_with_top_result(row._asdict(), co, country_code)
|
740 |
else:
|
741 |
cols[8].write("N/A")
|