Spaces:
Sleeping
Sleeping
feat: Convert application from Gradio to Streamlit
Browse files
ui.py
CHANGED
@@ -8,21 +8,24 @@ from ui_hybrid_matching import categorize_products_with_voyage_reranking
|
|
8 |
from ui_expanded_matching import categorize_products_with_openai_reranking
|
9 |
# Removed unused import: from ui_formatters import format_results_html
|
10 |
|
11 |
-
#
|
12 |
-
if 'ingredient_input' not in st.session_state:
|
13 |
-
st.session_state.ingredient_input = ""
|
14 |
-
if 'category_input' not in st.session_state:
|
15 |
-
st.session_state.category_input = ""
|
16 |
-
if 'voyage_input' not in st.session_state:
|
17 |
-
st.session_state.voyage_input = ""
|
18 |
-
if 'openai_input' not in st.session_state:
|
19 |
-
st.session_state.openai_input = ""
|
20 |
-
if 'compare_input' not in st.session_state:
|
21 |
-
st.session_state.compare_input = ""
|
22 |
|
23 |
|
24 |
def render_ui():
|
25 |
"""Render the Streamlit interface"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
# Page config is now set in app.py
|
27 |
st.title("Product Categorization Tool")
|
28 |
st.markdown("Analyze products by matching to ingredients or categories using AI embeddings.")
|
|
|
8 |
from ui_expanded_matching import categorize_products_with_openai_reranking
|
9 |
# Removed unused import: from ui_formatters import format_results_html
|
10 |
|
11 |
+
# Session state initialization moved into render_ui()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
|
14 |
def render_ui():
|
15 |
"""Render the Streamlit interface"""
|
16 |
+
|
17 |
+
# Initialize session state keys if they don't exist at the start of rendering
|
18 |
+
if 'ingredient_input' not in st.session_state:
|
19 |
+
st.session_state.ingredient_input = ""
|
20 |
+
if 'category_input' not in st.session_state:
|
21 |
+
st.session_state.category_input = ""
|
22 |
+
if 'voyage_input' not in st.session_state:
|
23 |
+
st.session_state.voyage_input = ""
|
24 |
+
if 'openai_input' not in st.session_state:
|
25 |
+
st.session_state.openai_input = ""
|
26 |
+
if 'compare_input' not in st.session_state:
|
27 |
+
st.session_state.compare_input = ""
|
28 |
+
|
29 |
# Page config is now set in app.py
|
30 |
st.title("Product Categorization Tool")
|
31 |
st.markdown("Analyze products by matching to ingredients or categories using AI embeddings.")
|