ssh-AI commited on
Commit
415de37
·
verified ·
1 Parent(s): 67c1381

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -51,6 +51,7 @@ if uploaded_files:
51
  st.markdown(f"---\n### 🖼️ {file.name}")
52
  original = Image.open(BytesIO(file_bytes)).convert("RGB")
53
 
 
54
  if f"original_{key}" not in st.session_state:
55
  st.session_state[f"original_{key}"] = original
56
  st.session_state[f"enhance_{key}"] = False
@@ -60,8 +61,16 @@ if uploaded_files:
60
  st.session_state[f"{key}_top"] = 0
61
  st.session_state[f"{key}_right"] = w
62
  st.session_state[f"{key}_bottom"] = h
63
- st.session_state[f"angle_{key}"] = 0 # ✅ default angle
64
 
 
 
 
 
 
 
 
 
65
  col1, col2 = st.columns([1, 1.5])
66
  with col1:
67
  if st.button("🔁 Reset", key=f"reset_{key}"):
@@ -73,7 +82,6 @@ if uploaded_files:
73
  st.session_state[f"{key}_right"] = w
74
  st.session_state[f"{key}_bottom"] = h
75
 
76
- # ✅ Rotate with session value sync
77
  angle = st.slider("🌀 Rotate", -180, 180, value=st.session_state[f"angle_{key}"], key=f"angle_{key}_slider")
78
  st.session_state[f"angle_{key}"] = angle
79
 
@@ -109,7 +117,7 @@ if uploaded_files:
109
  # --- EXPORT SECTION ---
110
  st.markdown("### 🧾 Export Options")
111
 
112
- # ZIP inline layout
113
  zip_col1, zip_col2 = st.columns([1, 2])
114
  with zip_col1:
115
  if st.button("📦 Generate ZIP"):
@@ -125,7 +133,7 @@ if uploaded_files:
125
  if "zip_file" in st.session_state:
126
  st.download_button("⬇️ Download ZIP", st.session_state["zip_file"], "images.zip", mime="application/zip", key="zip_dl")
127
 
128
- # PDF inline layout
129
  pdf_col1, pdf_col2 = st.columns([1, 2])
130
  with pdf_col1:
131
  if st.button("📄 Generate PDF"):
 
51
  st.markdown(f"---\n### 🖼️ {file.name}")
52
  original = Image.open(BytesIO(file_bytes)).convert("RGB")
53
 
54
+ # Init session state
55
  if f"original_{key}" not in st.session_state:
56
  st.session_state[f"original_{key}"] = original
57
  st.session_state[f"enhance_{key}"] = False
 
61
  st.session_state[f"{key}_top"] = 0
62
  st.session_state[f"{key}_right"] = w
63
  st.session_state[f"{key}_bottom"] = h
64
+ st.session_state[f"angle_{key}"] = 0
65
 
66
+ # ✅ NORMAL MODE HANDLING
67
+ if mode == "Normal Mode":
68
+ st.image(resize_image(original), use_container_width=True)
69
+ processed_images.append(original)
70
+ file_names.append(st.session_state[f"filename_{key}"])
71
+ continue
72
+
73
+ # ADVANCED MODE
74
  col1, col2 = st.columns([1, 1.5])
75
  with col1:
76
  if st.button("🔁 Reset", key=f"reset_{key}"):
 
82
  st.session_state[f"{key}_right"] = w
83
  st.session_state[f"{key}_bottom"] = h
84
 
 
85
  angle = st.slider("🌀 Rotate", -180, 180, value=st.session_state[f"angle_{key}"], key=f"angle_{key}_slider")
86
  st.session_state[f"angle_{key}"] = angle
87
 
 
117
  # --- EXPORT SECTION ---
118
  st.markdown("### 🧾 Export Options")
119
 
120
+ # ZIP layout
121
  zip_col1, zip_col2 = st.columns([1, 2])
122
  with zip_col1:
123
  if st.button("📦 Generate ZIP"):
 
133
  if "zip_file" in st.session_state:
134
  st.download_button("⬇️ Download ZIP", st.session_state["zip_file"], "images.zip", mime="application/zip", key="zip_dl")
135
 
136
+ # PDF layout
137
  pdf_col1, pdf_col2 = st.columns([1, 2])
138
  with pdf_col1:
139
  if st.button("📄 Generate PDF"):