Spaces:
Running
Running
Commit
·
249e203
1
Parent(s):
db78f1e
Add 'See in Code' button next to Reset button
Browse files
app.py
CHANGED
|
@@ -958,13 +958,30 @@ with col_output:
|
|
| 958 |
else:
|
| 959 |
st.info("Upload data, select categories, and click 'Classify Data' to see results here.")
|
| 960 |
|
| 961 |
-
#
|
| 962 |
-
|
| 963 |
-
|
| 964 |
-
st.
|
| 965 |
-
|
| 966 |
-
|
| 967 |
-
|
| 968 |
-
|
| 969 |
-
|
| 970 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 958 |
else:
|
| 959 |
st.info("Upload data, select categories, and click 'Classify Data' to see results here.")
|
| 960 |
|
| 961 |
+
# Bottom buttons
|
| 962 |
+
col_reset, col_code = st.columns(2)
|
| 963 |
+
with col_reset:
|
| 964 |
+
if st.button("Reset", type="secondary", use_container_width=True):
|
| 965 |
+
st.session_state.categories = [''] * MAX_CATEGORIES
|
| 966 |
+
st.session_state.category_count = INITIAL_CATEGORIES
|
| 967 |
+
st.session_state.task_mode = None
|
| 968 |
+
st.session_state.extracted_categories = None
|
| 969 |
+
st.session_state.results = None
|
| 970 |
+
if hasattr(st.session_state, 'example_loaded'):
|
| 971 |
+
del st.session_state.example_loaded
|
| 972 |
+
st.rerun()
|
| 973 |
+
|
| 974 |
+
with col_code:
|
| 975 |
+
if st.session_state.results:
|
| 976 |
+
if st.button("See in Code", use_container_width=True):
|
| 977 |
+
st.session_state.show_code_modal = True
|
| 978 |
+
|
| 979 |
+
# Code modal/dialog
|
| 980 |
+
if st.session_state.get('show_code_modal') and st.session_state.results:
|
| 981 |
+
st.markdown("---")
|
| 982 |
+
st.markdown("### Reproducibility Code")
|
| 983 |
+
st.markdown("Use this code to reproduce the classification with the CatLLM Python package:")
|
| 984 |
+
st.code(st.session_state.results['code'], language='python')
|
| 985 |
+
if st.button("Close"):
|
| 986 |
+
st.session_state.show_code_modal = False
|
| 987 |
+
st.rerun()
|