Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -76,17 +76,39 @@ def html(cards, pg, total):
|
|
76 |
return "<div style='text-align:center;padding:70px;color:#555;'>ํ์ํ ๋ฐฐํฌ๊ฐ ์์ต๋๋ค.</div>"
|
77 |
css = r"""
|
78 |
<style>
|
79 |
-
body {
|
|
|
|
|
80 |
margin: 0;
|
81 |
padding: 0;
|
82 |
font-family: Poppins, sans-serif;
|
83 |
background: #f0f0f0;
|
84 |
-
overflow: hidden;
|
85 |
}
|
86 |
-
.container {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
display: flex;
|
88 |
flex-direction: column;
|
89 |
-
|
|
|
|
|
|
|
|
|
90 |
box-sizing: border-box;
|
91 |
}
|
92 |
.grid {
|
@@ -95,11 +117,9 @@ def html(cards, pg, total):
|
|
95 |
grid-template-rows: repeat(3, 1fr);
|
96 |
gap: 10px;
|
97 |
width: 100%;
|
98 |
-
height:
|
99 |
-
box-sizing: border-box;
|
100 |
-
padding: 10px;
|
101 |
-
max-height: calc(100vh - 80px);
|
102 |
overflow: hidden;
|
|
|
103 |
}
|
104 |
.card {
|
105 |
background: #fff;
|
@@ -109,7 +129,7 @@ def html(cards, pg, total):
|
|
109 |
display: flex;
|
110 |
flex-direction: column;
|
111 |
height: 100%;
|
112 |
-
|
113 |
}
|
114 |
.hdr {
|
115 |
padding: 8px;
|
@@ -118,6 +138,7 @@ def html(cards, pg, total):
|
|
118 |
flex-shrink: 0;
|
119 |
height: 40px;
|
120 |
box-sizing: border-box;
|
|
|
121 |
}
|
122 |
.ttl {
|
123 |
margin: 0;
|
@@ -134,12 +155,12 @@ def html(cards, pg, total):
|
|
134 |
color: #777;
|
135 |
}
|
136 |
.frame {
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
139 |
overflow: hidden;
|
140 |
-
flex-grow: 1;
|
141 |
-
flex-shrink: 1;
|
142 |
-
height: calc(100% - 40px - 30px); /* ํค๋ ๋์ด์ ํธํฐ ๋์ด๋ฅผ ๋บ ๊ฐ */
|
143 |
}
|
144 |
.frame iframe {
|
145 |
position: absolute;
|
@@ -152,12 +173,16 @@ def html(cards, pg, total):
|
|
152 |
border: 0;
|
153 |
}
|
154 |
.foot {
|
|
|
|
|
|
|
|
|
155 |
padding: 6px;
|
156 |
background: rgba(255,255,255,.9);
|
157 |
text-align: right;
|
158 |
-
flex-shrink: 0;
|
159 |
height: 30px;
|
160 |
box-sizing: border-box;
|
|
|
161 |
}
|
162 |
.link {
|
163 |
font-size: 0.8rem;
|
@@ -167,20 +192,21 @@ def html(cards, pg, total):
|
|
167 |
}
|
168 |
.navigation-buttons {
|
169 |
position: fixed;
|
170 |
-
bottom:
|
171 |
left: 0;
|
172 |
right: 0;
|
173 |
display: flex;
|
174 |
justify-content: center;
|
175 |
gap: 30px;
|
176 |
-
padding:
|
177 |
z-index: 1000;
|
|
|
178 |
}
|
179 |
.navigation-buttons button {
|
180 |
background: rgba(255, 255, 255, 0.9);
|
181 |
border: 1px solid #ddd;
|
182 |
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
|
183 |
-
padding: 10px
|
184 |
border-radius: 30px;
|
185 |
font-size: 1.2rem;
|
186 |
font-weight: bold;
|
@@ -192,9 +218,35 @@ def html(cards, pg, total):
|
|
192 |
transform: translateY(-2px);
|
193 |
box-shadow: 0 6px 15px rgba(0,0,0,0.2);
|
194 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
</style>"""
|
196 |
|
197 |
-
h = css + "<div class='container'><div class='grid'>"
|
198 |
for c in cards:
|
199 |
date = datetime.datetime.fromtimestamp(int(c["ts"])).strftime("%Y-%m-%d")
|
200 |
h += f"""
|
@@ -206,15 +258,39 @@ def html(cards, pg, total):
|
|
206 |
</div>"""
|
207 |
h += "</div></div>"
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
return h
|
210 |
|
211 |
# โโโโโโโโโโโโโโโโโโโโโ 6. Gradio Blocks UI โโโโโโโโโโโโโโโโโโโ
|
212 |
def build():
|
213 |
_init_best()
|
214 |
-
with gr.Blocks(title="Vibe Game Craft", css="body{margin:0;padding:0;overflow:hidden;} footer{display:none;} .gradio-container{overflow:hidden;}") as demo:
|
215 |
# ์ํ ๋ฐ ์ถ๋ ฅ
|
216 |
bp = gr.State(1)
|
217 |
-
out = gr.HTML()
|
218 |
|
219 |
# ํ์ด์ง ๋ค๋น๊ฒ์ด์
|
220 |
with gr.Row(elem_classes="navigation-buttons"):
|
@@ -248,4 +324,4 @@ def build():
|
|
248 |
app = build()
|
249 |
|
250 |
if __name__ == "__main__":
|
251 |
-
app.launch()
|
|
|
76 |
return "<div style='text-align:center;padding:70px;color:#555;'>ํ์ํ ๋ฐฐํฌ๊ฐ ์์ต๋๋ค.</div>"
|
77 |
css = r"""
|
78 |
<style>
|
79 |
+
html, body {
|
80 |
+
height: 100%;
|
81 |
+
overflow: hidden !important;
|
82 |
margin: 0;
|
83 |
padding: 0;
|
84 |
font-family: Poppins, sans-serif;
|
85 |
background: #f0f0f0;
|
|
|
86 |
}
|
87 |
+
#gradio-app, #component-0, #component-1, .gradio-container {
|
88 |
+
height: 100vh !important;
|
89 |
+
overflow: hidden !important;
|
90 |
+
position: fixed !important;
|
91 |
+
top: 0 !important;
|
92 |
+
left: 0 !important;
|
93 |
+
right: 0 !important;
|
94 |
+
bottom: 0 !important;
|
95 |
+
}
|
96 |
+
.main-container {
|
97 |
+
position: fixed;
|
98 |
+
top: 0;
|
99 |
+
left: 0;
|
100 |
+
right: 0;
|
101 |
+
bottom: 0;
|
102 |
+
height: 100vh;
|
103 |
+
width: 100vw;
|
104 |
+
overflow: hidden;
|
105 |
display: flex;
|
106 |
flex-direction: column;
|
107 |
+
}
|
108 |
+
.grid-container {
|
109 |
+
flex: 1;
|
110 |
+
overflow: hidden;
|
111 |
+
padding: 10px;
|
112 |
box-sizing: border-box;
|
113 |
}
|
114 |
.grid {
|
|
|
117 |
grid-template-rows: repeat(3, 1fr);
|
118 |
gap: 10px;
|
119 |
width: 100%;
|
120 |
+
height: 100%;
|
|
|
|
|
|
|
121 |
overflow: hidden;
|
122 |
+
box-sizing: border-box;
|
123 |
}
|
124 |
.card {
|
125 |
background: #fff;
|
|
|
129 |
display: flex;
|
130 |
flex-direction: column;
|
131 |
height: 100%;
|
132 |
+
position: relative;
|
133 |
}
|
134 |
.hdr {
|
135 |
padding: 8px;
|
|
|
138 |
flex-shrink: 0;
|
139 |
height: 40px;
|
140 |
box-sizing: border-box;
|
141 |
+
z-index: 2;
|
142 |
}
|
143 |
.ttl {
|
144 |
margin: 0;
|
|
|
155 |
color: #777;
|
156 |
}
|
157 |
.frame {
|
158 |
+
position: absolute;
|
159 |
+
top: 40px;
|
160 |
+
left: 0;
|
161 |
+
right: 0;
|
162 |
+
bottom: 30px;
|
163 |
overflow: hidden;
|
|
|
|
|
|
|
164 |
}
|
165 |
.frame iframe {
|
166 |
position: absolute;
|
|
|
173 |
border: 0;
|
174 |
}
|
175 |
.foot {
|
176 |
+
position: absolute;
|
177 |
+
bottom: 0;
|
178 |
+
left: 0;
|
179 |
+
right: 0;
|
180 |
padding: 6px;
|
181 |
background: rgba(255,255,255,.9);
|
182 |
text-align: right;
|
|
|
183 |
height: 30px;
|
184 |
box-sizing: border-box;
|
185 |
+
z-index: 2;
|
186 |
}
|
187 |
.link {
|
188 |
font-size: 0.8rem;
|
|
|
192 |
}
|
193 |
.navigation-buttons {
|
194 |
position: fixed;
|
195 |
+
bottom: 15px;
|
196 |
left: 0;
|
197 |
right: 0;
|
198 |
display: flex;
|
199 |
justify-content: center;
|
200 |
gap: 30px;
|
201 |
+
padding: 10px;
|
202 |
z-index: 1000;
|
203 |
+
background: transparent;
|
204 |
}
|
205 |
.navigation-buttons button {
|
206 |
background: rgba(255, 255, 255, 0.9);
|
207 |
border: 1px solid #ddd;
|
208 |
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
|
209 |
+
padding: 10px 30px;
|
210 |
border-radius: 30px;
|
211 |
font-size: 1.2rem;
|
212 |
font-weight: bold;
|
|
|
218 |
transform: translateY(-2px);
|
219 |
box-shadow: 0 6px 15px rgba(0,0,0,0.2);
|
220 |
}
|
221 |
+
footer, .footer {
|
222 |
+
display: none !important;
|
223 |
+
}
|
224 |
+
.page-info {
|
225 |
+
position: fixed;
|
226 |
+
bottom: 5px;
|
227 |
+
left: 0;
|
228 |
+
right: 0;
|
229 |
+
text-align: center;
|
230 |
+
font-size: 0.8rem;
|
231 |
+
color: #777;
|
232 |
+
z-index: 999;
|
233 |
+
}
|
234 |
+
|
235 |
+
/* ๋ชจ๋ฐ์ผ ์ต์ ํ */
|
236 |
+
@media (max-width: 768px) {
|
237 |
+
.grid {
|
238 |
+
grid-template-columns: repeat(2, 1fr);
|
239 |
+
grid-template-rows: repeat(5, 1fr);
|
240 |
+
}
|
241 |
+
}
|
242 |
+
@media (max-width: 480px) {
|
243 |
+
.grid {
|
244 |
+
grid-template-columns: 1fr;
|
245 |
+
}
|
246 |
+
}
|
247 |
</style>"""
|
248 |
|
249 |
+
h = css + "<div class='main-container'><div class='grid-container'><div class='grid'>"
|
250 |
for c in cards:
|
251 |
date = datetime.datetime.fromtimestamp(int(c["ts"])).strftime("%Y-%m-%d")
|
252 |
h += f"""
|
|
|
258 |
</div>"""
|
259 |
h += "</div></div>"
|
260 |
|
261 |
+
# ํ์ด์ง ์ ๋ณด
|
262 |
+
h += f"<div class='page-info'>Page {pg} / {total}</div></div>"
|
263 |
+
|
264 |
+
# JavaScript๋ก ์คํฌ๋กค ๋ฐฉ์ง ์ถ๊ฐ
|
265 |
+
h += """
|
266 |
+
<script>
|
267 |
+
// ์คํฌ๋กค ๋ฐฉ์ง
|
268 |
+
document.addEventListener('DOMContentLoaded', function() {
|
269 |
+
document.body.style.overflow = 'hidden';
|
270 |
+
document.documentElement.style.overflow = 'hidden';
|
271 |
+
|
272 |
+
// ํฐ์น ์ด๋ฒคํธ ๋ฐฉ์ง (๋ชจ๋ฐ์ผ)
|
273 |
+
document.addEventListener('touchmove', function(e) {
|
274 |
+
e.preventDefault();
|
275 |
+
}, { passive: false });
|
276 |
+
|
277 |
+
// ์คํฌ๋กค ์ด๋ฒคํธ ๋ฐฉ์ง
|
278 |
+
document.addEventListener('wheel', function(e) {
|
279 |
+
e.preventDefault();
|
280 |
+
}, { passive: false });
|
281 |
+
});
|
282 |
+
</script>
|
283 |
+
"""
|
284 |
+
|
285 |
return h
|
286 |
|
287 |
# โโโโโโโโโโโโโโโโโโโโโ 6. Gradio Blocks UI โโโโโโโโโโโโโโโโโโโ
|
288 |
def build():
|
289 |
_init_best()
|
290 |
+
with gr.Blocks(title="Vibe Game Craft", css="html,body{margin:0;padding:0;overflow:hidden !important;} footer{display:none !important;} .gradio-container{overflow:hidden !important; height:100vh; position:fixed; top:0; left:0; right:0; bottom:0;}") as demo:
|
291 |
# ์ํ ๋ฐ ์ถ๋ ฅ
|
292 |
bp = gr.State(1)
|
293 |
+
out = gr.HTML(elem_id="main-output")
|
294 |
|
295 |
# ํ์ด์ง ๋ค๋น๊ฒ์ด์
|
296 |
with gr.Row(elem_classes="navigation-buttons"):
|
|
|
324 |
app = build()
|
325 |
|
326 |
if __name__ == "__main__":
|
327 |
+
app.launch(debug=True, height=100)
|