Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +15 -4
src/streamlit_app.py
CHANGED
|
@@ -383,9 +383,12 @@ with col1:
|
|
| 383 |
)
|
| 384 |
|
| 385 |
# Store in session state only if a new file is uploaded
|
|
|
|
|
|
|
|
|
|
| 386 |
if uploaded_file is not None:
|
| 387 |
-
st.session_state['uploaded_image']
|
| 388 |
-
|
| 389 |
# Display the uploaded image if available
|
| 390 |
#if st.session_state['uploaded_image'] is not None:
|
| 391 |
# st.image(st.session_state['uploaded_image'], caption="Uploaded Kolam", use_column_width=True)
|
|
@@ -428,8 +431,14 @@ with col1:
|
|
| 428 |
#st.session_state.encryption_key = encryption_key
|
| 429 |
|
| 430 |
#st.success("β
Analysis completed successfully!")
|
|
|
|
|
|
|
|
|
|
| 431 |
if st.session_state['uploaded_image'] is not None:
|
| 432 |
-
|
|
|
|
|
|
|
|
|
|
| 433 |
with st.spinner("Analyzing Kolam design..."):
|
| 434 |
# Process image
|
| 435 |
original, thresh, edges = analyzer.preprocess_image(
|
|
@@ -465,7 +474,9 @@ with col1:
|
|
| 465 |
with col2:
|
| 466 |
st.markdown("### π Analysis Results")
|
| 467 |
|
| 468 |
-
if hasattr(st.session_state, 'analysis_complete') and st.session_state.analysis_complete:
|
|
|
|
|
|
|
| 469 |
|
| 470 |
# Create tabs for different visualizations
|
| 471 |
tab1, tab2, tab3, tab4 = st.tabs(["πΌοΈ Image Processing", "π Graph Analysis", "π Features", "π Security"])
|
|
|
|
| 383 |
)
|
| 384 |
|
| 385 |
# Store in session state only if a new file is uploaded
|
| 386 |
+
#if uploaded_file is not None:
|
| 387 |
+
#st.session_state['uploaded_image'] = Image.open(uploaded_file)
|
| 388 |
+
# Only update session state if a new file is uploaded
|
| 389 |
if uploaded_file is not None:
|
| 390 |
+
if st.session_state['uploaded_image'] is None:
|
| 391 |
+
st.session_state['uploaded_image'] = Image.open(uploaded_file)
|
| 392 |
# Display the uploaded image if available
|
| 393 |
#if st.session_state['uploaded_image'] is not None:
|
| 394 |
# st.image(st.session_state['uploaded_image'], caption="Uploaded Kolam", use_column_width=True)
|
|
|
|
| 431 |
#st.session_state.encryption_key = encryption_key
|
| 432 |
|
| 433 |
#st.success("β
Analysis completed successfully!")
|
| 434 |
+
#if st.session_state['uploaded_image'] is not None:
|
| 435 |
+
#if st.button("π Analyze Kolam Design", type="primary"):
|
| 436 |
+
#with st.spinner("Analyzing Kolam design..."):
|
| 437 |
if st.session_state['uploaded_image'] is not None:
|
| 438 |
+
st.image(st.session_state['uploaded_image'], caption="Uploaded Kolam", use_column_width=True)
|
| 439 |
+
|
| 440 |
+
# Analysis button
|
| 441 |
+
if st.button("π Analyze Kolam Design"):
|
| 442 |
with st.spinner("Analyzing Kolam design..."):
|
| 443 |
# Process image
|
| 444 |
original, thresh, edges = analyzer.preprocess_image(
|
|
|
|
| 474 |
with col2:
|
| 475 |
st.markdown("### π Analysis Results")
|
| 476 |
|
| 477 |
+
#if hasattr(st.session_state, 'analysis_complete') and st.session_state.analysis_complete:
|
| 478 |
+
if st.session_state.analysis_complete:
|
| 479 |
+
# Use st.session_state.original_img, st.session_state.graph, etc.
|
| 480 |
|
| 481 |
# Create tabs for different visualizations
|
| 482 |
tab1, tab2, tab3, tab4 = st.tabs(["πΌοΈ Image Processing", "π Graph Analysis", "π Features", "π Security"])
|