Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -187,24 +187,28 @@ try:
|
|
187 |
st.session_state.fixed_image_enabled = False
|
188 |
|
189 |
# ๋จ์ผ ์ด๋ฏธ์ง ๋ชจ๋ ํ์ธ
|
190 |
-
|
191 |
st.session_state.fixed_image_enabled = True
|
192 |
|
193 |
# ํน์ ์ด๋ฏธ์ง ์ธ๋ฑ์ค๊ฐ ์ง์ ๋์๋์ง ํ์ธ
|
194 |
-
if "image" in query_params
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
os.
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
|
|
|
|
|
|
|
|
208 |
except Exception as e:
|
209 |
st.error(f"URL ํ๋ผ๋ฏธํฐ ์ฒ๋ฆฌ ์ค ์ค๋ฅ ๋ฐ์: {e}")
|
210 |
|
@@ -242,12 +246,13 @@ if 'fixed_image_path' not in st.session_state and st.session_state.contents:
|
|
242 |
|
243 |
# ์ฌ๋ผ์ด๋์ผ ์๋ ์์ ๋ก์ง
|
244 |
if not st.session_state.app_loaded and not st.session_state.get('preview_mode', False):
|
245 |
-
if st.session_state.contents: # ์ด๋ฏธ์ง๊ฐ
|
246 |
st.session_state.preview_mode = True
|
247 |
st.session_state.preview_start_time = time.time()
|
248 |
st.session_state.activate_fullscreen = True
|
249 |
st.session_state.app_loaded = True # ์ฑ์ด ๋ก๋๋์์์ ํ์
|
250 |
|
|
|
251 |
# ์ฌ์ด๋๋ฐ - ์ด๋ฏธ์ง ๊ด๋ฆฌ
|
252 |
with st.sidebar:
|
253 |
st.title("๐ธ ๋์คํ๋ ์ด ์ค์ ")
|
|
|
187 |
st.session_state.fixed_image_enabled = False
|
188 |
|
189 |
# ๋จ์ผ ์ด๋ฏธ์ง ๋ชจ๋ ํ์ธ
|
190 |
+
elif "1image" in query_params: # change์ 1image ๋ ๋ค ์์ผ๋ฉด change๊ฐ ์ฐ์ ํ๋๋ก elif ์ฌ์ฉ
|
191 |
st.session_state.fixed_image_enabled = True
|
192 |
|
193 |
# ํน์ ์ด๋ฏธ์ง ์ธ๋ฑ์ค๊ฐ ์ง์ ๋์๋์ง ํ์ธ
|
194 |
+
if "image" in query_params:
|
195 |
+
try:
|
196 |
+
img_index = int(query_params["image"])
|
197 |
+
|
198 |
+
# contents ํด๋ ๋ด์ ๋ชจ๋ ์ด๋ฏธ์ง ํ์ผ ๋ฏธ๋ฆฌ ๋ก๋
|
199 |
+
if not os.path.exists('contents'):
|
200 |
+
os.makedirs('contents')
|
201 |
+
|
202 |
+
image_files = glob.glob('contents/*.jpg') + glob.glob('contents/*.jpeg') + glob.glob('contents/*.png')
|
203 |
+
|
204 |
+
# ์ธ๋ฑ์ค๊ฐ ์ ํจํ์ง ํ์ธ
|
205 |
+
if 0 <= img_index < len(image_files):
|
206 |
+
st.session_state.fixed_image_path = image_files[img_index]
|
207 |
+
elif image_files: # ์ ํจํ์ง ์์ง๋ง ์ด๋ฏธ์ง๊ฐ ์๋ ๊ฒฝ์ฐ ์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง ์ฌ์ฉ
|
208 |
+
st.session_state.fixed_image_path = image_files[0]
|
209 |
+
except ValueError:
|
210 |
+
# ์ซ์๋ก ๋ณํํ ์ ์๋ ๊ฒฝ์ฐ
|
211 |
+
pass
|
212 |
except Exception as e:
|
213 |
st.error(f"URL ํ๋ผ๋ฏธํฐ ์ฒ๋ฆฌ ์ค ์ค๋ฅ ๋ฐ์: {e}")
|
214 |
|
|
|
246 |
|
247 |
# ์ฌ๋ผ์ด๋์ผ ์๋ ์์ ๋ก์ง
|
248 |
if not st.session_state.app_loaded and not st.session_state.get('preview_mode', False):
|
249 |
+
if st.session_state.contents and not st.session_state.fixed_image_enabled: # ์ด๋ฏธ์ง๊ฐ ์๊ณ ๊ณ ์ ๋ชจ๋๊ฐ ์๋ ๊ฒฝ์ฐ์๋ง ์๋ ์์
|
250 |
st.session_state.preview_mode = True
|
251 |
st.session_state.preview_start_time = time.time()
|
252 |
st.session_state.activate_fullscreen = True
|
253 |
st.session_state.app_loaded = True # ์ฑ์ด ๋ก๋๋์์์ ํ์
|
254 |
|
255 |
+
|
256 |
# ์ฌ์ด๋๋ฐ - ์ด๋ฏธ์ง ๊ด๋ฆฌ
|
257 |
with st.sidebar:
|
258 |
st.title("๐ธ ๋์คํ๋ ์ด ์ค์ ")
|