Update app.py
Browse files
app.py
CHANGED
@@ -133,19 +133,22 @@ with tab3:
|
|
133 |
query = st.text_input('Query for A/B Test')
|
134 |
url = st.text_input('URL for A/B Test')
|
135 |
|
|
|
|
|
|
|
136 |
if st.button('Scrape A/B'):
|
137 |
title_A, description_A = extract_title_description(url)
|
138 |
st.session_state['title_A'] = title_A
|
139 |
st.session_state['description_A'] = description_A
|
140 |
-
st.
|
141 |
-
|
142 |
-
|
143 |
title_B = st.text_input('Title B', value=st.session_state.get('title_A', ''))
|
144 |
description_B = st.text_area('Description B', value=st.session_state.get('description_A', ''))
|
145 |
|
146 |
if st.button('Predict A/B'):
|
147 |
if query and url:
|
148 |
-
binary_result_A, confidence_A = predict(query, title_A, description_A, url, fasttext_model)
|
149 |
binary_result_B, confidence_B = predict(query, title_B, description_B, url, fasttext_model)
|
150 |
|
151 |
st.write(f'Results for A: Predicted +/-: {binary_result_A}, Conf.: {confidence_A:.2%}')
|
@@ -157,5 +160,3 @@ with tab3:
|
|
157 |
st.write("B is better than A")
|
158 |
else:
|
159 |
st.write("B is the same as A")
|
160 |
-
else:
|
161 |
-
st.write('Please enter both a query and a URL.')
|
|
|
133 |
query = st.text_input('Query for A/B Test')
|
134 |
url = st.text_input('URL for A/B Test')
|
135 |
|
136 |
+
if 'step' not in st.session_state:
|
137 |
+
st.session_state.step = 0
|
138 |
+
|
139 |
if st.button('Scrape A/B'):
|
140 |
title_A, description_A = extract_title_description(url)
|
141 |
st.session_state['title_A'] = title_A
|
142 |
st.session_state['description_A'] = description_A
|
143 |
+
st.session_state.step = 1
|
144 |
+
|
145 |
+
if st.session_state.step == 1:
|
146 |
title_B = st.text_input('Title B', value=st.session_state.get('title_A', ''))
|
147 |
description_B = st.text_area('Description B', value=st.session_state.get('description_A', ''))
|
148 |
|
149 |
if st.button('Predict A/B'):
|
150 |
if query and url:
|
151 |
+
binary_result_A, confidence_A = predict(query, st.session_state['title_A'], st.session_state['description_A'], url, fasttext_model)
|
152 |
binary_result_B, confidence_B = predict(query, title_B, description_B, url, fasttext_model)
|
153 |
|
154 |
st.write(f'Results for A: Predicted +/-: {binary_result_A}, Conf.: {confidence_A:.2%}')
|
|
|
160 |
st.write("B is better than A")
|
161 |
else:
|
162 |
st.write("B is the same as A")
|
|
|
|